Sujet : New milestone time formatting (Was: Differences among the "bomb" and "xbetween")
De : janburse (at) *nospam* fastmail.fm (Mild Shock)
Groupes : comp.lang.prologDate : 26. Sep 2024, 12:22:24
Autres entêtes
Message-ID : <vd3g5f$p0ar$1@solani.org>
References : 1 2 3 4 5 6
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19
This became a rather lengthy subproject,
but still a rewarding one. Here are the
changes:
- atom_time/3: Renamed sys_time_atom/3 to
atom_time/3. Changed signature a little bit,
this is to format and scan local times.
- atom_utctime/3: Landed in library(util/spin).
This is to format and scan local times.
Can other Prolog systems implement atom_utctime/3
correctly. SWI-Prolog lacks the mode scan mode,
and formatting goes wrong:
/* SWI-Prolog 9.3.11 */
?- format_time(atom(X), '%a, %d %b %Y %H:%M:%S', 1725635101.000, posix).
X = 'Fri, 06 Sep 2024 17:05:01'.
/* Dogelog Player 1.2.3 */
?- atom_utctime(X, '%a, %d %b %Y %H:%M:%S', 1725635101000).
X = 'Fri, 06 Sep 2024 15:05:01'.
The above is from a machine without locale 'C'.
Its not suitable for rfc1123. What does SWI-Prolog
do, it uses weekday and month names from GMT,
but otherwise it uses local hours:
1725635101 Timestamp to Human date [batch convert]
Supports Unix timestamps in seconds,
milliseconds, microseconds and nanoseconds.
Assuming that this timestamp is in seconds:
GMT: Friday, 6. September 2024 15:05:01
Your time zone: Freitag, 6. September 2024 17:05:01 GMT+02:00 DST
Relative: 20 days ago
https://www.epochconverter.com/See also:
All HTTP date/time stamps MUST be represented in
Greenwich Mean Time (GMT), without exception.
https://datatracker.ietf.org/doc/html/rfc2616#section-3.3.1