[Larceny-users] Getting unix-era time in Larceny
Lars T Hansen
lth at acm.org
Mon Mar 26 16:13:33 EDT 2007
On 3/26/07, David Rush <kumoyuki at gmail.com> wrote:
> Hi y'all,
>
> I'm sure there is a straightforward way to get this that my incipient
> migraine is preventing me from finding. The closest I have seen so far
> appears to be the entry point osdep_cpuclock or possibly
> osdep_realclock down in the Rts innards. I can't see how either of
> these get surfaced to procedures at the repl.
>
> And just to be difficult, I do need it to work on windows :) Any suggestions?
Strikes me as something there ought to be a simple syscall for.
If you're happy with 1 second resolution, you can cobble something
together with with-output-to-file, display, and
file-modification-time, but it's not exactly pretty:
(define (now)
(with-output-to-file "/tmp/fnord"
(lambda () (display "x")))
(file-modification-time "/tmp/fnord"))
With a randomly generated file name and some platform adaptation this
might even approach being robust...
--lars
More information about the Larceny-users
mailing list