unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: adriano <randomlooser@riseup.net>
To: Vivien <vivien@planete-kraus.eu>, guile-user@gnu.org
Subject: Re: timestamp
Date: Sat, 12 Feb 2022 10:43:52 +0100	[thread overview]
Message-ID: <098bbd5f1c81414521015479b7e2b17d8809f1bd.camel@riseup.net> (raw)
In-Reply-To: <9d45b2d6c007a8e9ca1e0656deed190f1181e035.camel@planete-kraus.eu>

Vivien,

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
"cat.jpg"))))
$2 = "dom 13 dic 2020, 07:44:50"


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

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
     used.


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

11

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

I'm unhappy with 

(tm:year $3)

This returns

120

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

https://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html

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	other threads:[~2022-02-12  9:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12  8:37 timestamp adriano
2022-02-12  8:52 ` timestamp Vivien
2022-02-12  9:43   ` adriano [this message]
2022-02-12 11:49     ` timestamp Ricardo Wurmus
2022-02-12 12:32       ` timestamp tomas
2022-02-12 12:38       ` timestamp Eli Zaretskii
2022-02-12 13:30       ` timestamp adriano
2022-02-12 13:42         ` timestamp adriano
2022-02-12 13:49         ` timestamp Ricardo Wurmus
2022-02-12 13:55           ` timestamp adriano
2022-02-12 14:01             ` Guile cookbook ? adriano
2022-02-12 14:15               ` Ricardo Wurmus
2022-02-12 15:01                 ` adriano
2022-02-12 15:30               ` Olivier Dion via General Guile related discussions
2022-02-12 17:11               ` Zelphir Kaltstahl
2022-02-12 17:32           ` timestamp Eli Zaretskii
2022-02-12 17:48             ` Examples in Guile documentation Zelphir Kaltstahl
2022-02-12  9:01 ` timestamp tomas
2022-02-12  9:49   ` timestamp adriano
2022-02-12 12:50   ` timestamp Eli Zaretskii
2022-02-12 13:01     ` timestamp tomas
2022-02-12 15:23     ` timestamp adriano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=098bbd5f1c81414521015479b7e2b17d8809f1bd.camel@riseup.net \
    --to=randomlooser@riseup.net \
    --cc=guile-user@gnu.org \
    --cc=vivien@planete-kraus.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).