[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: timestamp

From: adriano
Subject: Re: timestamp
Date: Sat, 12 Feb 2022 10:43:52 +0100


thank you !

Il giorno sab, 12/02/2022 alle 09.52 +0100, Vivien ha scritto:
> (use-modules (srfi srfi-19)) ;; Time and date stuff
> (time-utc->date (make-time time-utc 0 1607841890)) 
> ;; Zero for nanoseconds comes before the seconds
> Vivien

I also found this

scheme@(guile-user)> (strftime "%c" (localtime (stat:ctime (stat
$2 = "dom 13 dic 2020, 07:44:50"

On one side, this gives me something I can grasp, localized and all.

On another side, it opens new misteries

 ,d localtime
- Scheme Procedure: localtime time [zone]
     Return an object representing the broken down components of TIME,
     an integer like the one returned by `current-time'.  The time zone
     for the calculation is optionally specified by ZONE (a string),
     otherwise the `TZ' environment variable or the system default is

So, "the broken down components of TIME"

Let's take a look

scheme@(guile-user)> (localtime (stat:ctime (stat "cat.jpg")))
$3 = #(50 44 7 13 11 120 0 347 0 -3600 "CET")

What are those numbers ?

broken down according to which schema ?

Say I want to extract the month from $3, how do I do that ?

It seesm to be

(tm:mon %3)

This returns


I expected 12 but ok, I recognize this kind of weirdness

I'm unhappy with 

(tm:year $3)

This returns


it's 2020

Why would 120 represent 2020 ?

I guess there's some implied schema being used, here

Probably defined in glibc ?

It seems this is something obvious to people well versed in the
conventions of "The GNU System" so of course it's not explicit in this
paragraph of the manual (as far as I can tell, maybe I'm not reading
hard enough)

Ok, so, this seems relevant

The "tm" 'struct' is being referred to in the Guile manual and it's
implicit that it's defined elsewhere

This habit of giving the GNU system and the glibc as an _implicit_
requirement is wrong, in my opinion, it's pointlessly punishing

I understand where it comes from

But I think it's be way more useful if the Guile docs introduced people
to the whole thing (whatever that is), not to a fragment

But that's for a different discussion

Thanks again, Vivien

reply via email to

[Prev in Thread] Current Thread [Next in Thread]