Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Mild Shock Newsgroups: comp.lang.prolog Subject: New milestone time formatting (Was: Differences among the "bomb" and "xbetween") Date: Thu, 26 Sep 2024 13:22:24 +0200 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 26 Sep 2024 11:22:23 -0000 (UTC) Injection-Info: solani.org; logging-data="819547"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19 Cancel-Lock: sha1:RzKFsM32lSlIiPFYGhP6jAQ3UN4= In-Reply-To: X-User-ID: eJwNyskRwDAIBLCWwLAc5RgC/ZcQPzUjiLG1q8EUixWCZGrcHvaRaeKHilIaHEE4645XqJ/Fl86Ub93TNwsjPzcQFQs= Bytes: 2671 Lines: 42 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