If all you want is to normalize to days, then something like this would
work:
: normalize-to-days ( duration -- duration )
[ 60 /mod ] change-second
[ + 60 /mod ] change-minute
[ + 24 /mod ] change-hour
[ + ] change-day ;
On Wed, Jul 20, 2016 at 8:18 AM, Alexander Ilin <ajs...@yandex.ru> wrote:
> Hello!
>
> 20.07.2016, 17:59, "John Benediktsson" <mrj...@gmail.com>:
>
> I think the reason there is no "normalize" is because duration can have
> months and years and those mean different things depending on what
> timestamp they are relative to.
>
>
>
> I don't quite understand. Are you talking about the different number of
> seconds in different years? If that's the case, then we are indeed screwed.
>
> I'm proposing to only normalize the part of duration that deals with
> seconds, minutes, hours and days. Maybe with a warning about leap years and
> such in the documentation. If we agree that days are always 24*60*60
> seconds long, then we can put all the overflow into days and be done with
> it. That's all the normalization I need. Everything above days would be
> subjected to days-in-month and other limitations, which are only usefully
> known when applied to the specific timestamps with time+ and time-.
>
> Maybe if days can have different lengths (I'm not an expert in this),
> then can we at least state that hours are 60*60 seconds long?
>
> Maybe normalize-time would be a better name.
>
>
> Agreed on localization, someone we also need for number printing. It just
> hasn't been built yet.
>
>
> Oh, I'm so glad that's not in yet, because I prefer to have consistent
> formatting to one that's always localized. One of the pitfalls I happened
> to step into (and some of my fellow developers discussed same issue but a
> few months ago) is storing numbers in a text file, and then failing to load
> them properly due to comma vs. dot as the decimal separator on source vs.
> target PCs. That presentation-level stuff needs to be purposely activated
> on the outer layers of the system, not automatically enforced in the core.
> That's my opinion.
>
> ---=====---
> Александр
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports.http://sdm.link/zohodev2dev
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk