* Elegant way to time function execution
@ 2016-09-03 21:12 Christopher Baines
2016-09-04 6:31 ` Nala Ginrut
2016-09-04 11:17 ` Amirouche Boubekki
0 siblings, 2 replies; 4+ messages in thread
From: Christopher Baines @ 2016-09-03 21:12 UTC (permalink / raw)
To: guile-user
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
So I have managed to get something working with srfi-19, but the output
is not very readable:
#<time type: time-duration nanosecond: 1482337000 second: 0>
I tried a couple of ways to make this human readable, but before I write
something myself, I thought I would check if anyone knows of some
existing code to make time durations human readable?
Thanks,
Chris
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 955 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Elegant way to time function execution
2016-09-03 21:12 Elegant way to time function execution Christopher Baines
@ 2016-09-04 6:31 ` Nala Ginrut
2016-09-04 11:35 ` Taylan Ulrich Bayırlı/Kammer
2016-09-04 11:17 ` Amirouche Boubekki
1 sibling, 1 reply; 4+ messages in thread
From: Nala Ginrut @ 2016-09-04 6:31 UTC (permalink / raw)
To: Christopher Baines, guile-user
You may try time-utc->date or it's friends to convert seconds to
Y/M/D/h/m/s. But you may need to write a function to print each field.
BTW, ",a" command in the REPL is your friend when you have no any clue
about what function may work.
Best regards.
On Sat, 2016-09-03 at 22:12 +0100, Christopher Baines wrote:
> So I have managed to get something working with srfi-19, but the
> output
> is not very readable:
> #<time type: time-duration nanosecond: 1482337000 second: 0>
>
> I tried a couple of ways to make this human readable, but before I
> write
> something myself, I thought I would check if anyone knows of some
> existing code to make time durations human readable?
>
> Thanks,
>
> Chris
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Elegant way to time function execution
2016-09-03 21:12 Elegant way to time function execution Christopher Baines
2016-09-04 6:31 ` Nala Ginrut
@ 2016-09-04 11:17 ` Amirouche Boubekki
1 sibling, 0 replies; 4+ messages in thread
From: Amirouche Boubekki @ 2016-09-04 11:17 UTC (permalink / raw)
To: Christopher Baines; +Cc: guile-user, guile-user
On 2016-09-03 23:12, Christopher Baines wrote:
> So I have managed to get something working with srfi-19, but the output
> is not very readable:
> #<time type: time-duration nanosecond: 1482337000 second: 0>
>
> I tried a couple of ways to make this human readable, but before I
> write
> something myself, I thought I would check if anyone knows of some
> existing code to make time durations human readable?
Like translating 60 seconds to the string "one minute"?
--
Amirouche ~ amz3 ~ http://www.hyperdev.fr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Elegant way to time function execution
2016-09-04 6:31 ` Nala Ginrut
@ 2016-09-04 11:35 ` Taylan Ulrich Bayırlı/Kammer
0 siblings, 0 replies; 4+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2016-09-04 11:35 UTC (permalink / raw)
To: Nala Ginrut; +Cc: guile-user
Nala Ginrut <nalaginrut@gmail.com> writes:
> You may try time-utc->date or it's friends to convert seconds to
> Y/M/D/h/m/s. But you may need to write a function to print each field.
> BTW, ",a" command in the REPL is your friend when you have no any clue
> about what function may work.
Reading SRFI 19, I can't be sure, but I suspect that it's supposed to be
an error to use a "time-utc->..." procedure on a time object with type
"time-duration".
The easiest way to make a time-duration type of time object readable
that I can see is turning it into plain seconds via:
(+ (time-second t)
(/ (time-nanosecond t) 1000000000))
Taylan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-04 11:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-03 21:12 Elegant way to time function execution Christopher Baines
2016-09-04 6:31 ` Nala Ginrut
2016-09-04 11:35 ` Taylan Ulrich Bayırlı/Kammer
2016-09-04 11:17 ` Amirouche Boubekki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).