Hello!

  On the second thought, that may be overengineering a bit. After all, do I 
need to create a duration object and a string stream (within a namespace to 
override output-stream) just to do some string manipulation? Here's a solution 
with smaller overhead :

: seconds>hms ( n -- str )
    60 /mod round [ 60 /mod round ] dip 3array [ pad-00 ] map ":" join ;

20.07.2016, 10:44, "Alexander Ilin" <ajs...@yandex.ru>:
> Hello!
>
>   I'm measuring some processes, which take anywhere from seconds to hours to 
> run.
>   I record the number of seconds in a DB for future reference.
>   When presenting the data to the user (myself) I want to see a hh:mm:ss 
> string instead of thousands of seconds.
>
>   Is there a way to format a duration tuple in such a way? The closest thing 
> I found is timestamp>hms, which does exactly what I want, but it is TYPED:, 
> and only accepts timestamps. Can I add the following word to the 
> calendar.format, or is there a better way?
>
> TYPED: duration>hms ( duration: duration -- str )
>     [ (timestamp>hms) ] with-string-writer ;
>
> ---=====---
>  Александр
>
> ------------------------------------------------------------------------------
> 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

Reply via email to