Subj : JS Object save_msg()
To : deon
From : Digital Man
Date : Mon Dec 16 2024 10:09 pm
Re: JS Object save_msg()
By: deon to Digital Man on Tue Dec 17 2024 02:50 pm
> Hey DM,
>
> Need some clarification - I've noticed an unexpected date when saving a
> message (when called from CLI jsexec - havent checked when the terminal
> server calling the script).
>
> I'm calling save_msg(), using a header with a date that has:
>
> RFC-822 format (as per the
https://synchro.net/docs/jsobjs.html), and that
> results in a message time of:
>
> date = strftime("%a, %d %b %Y %I:%M:%S %z",time());
> // Tue, 17 Dec 2024 02:32:19 +1100
MsgBase.save_msg() will using the current date/time and time zone when saving a message. You have a reason to not do this?
> (I know time() is implied with strftime()).
>
> when_written 67604803 0294 Tue Dec 17 02:32:19 2024 UTC+11:00
> when_imported 6760F0C3 0000 Tue Dec 17 14:32:19 2024 UTC
>
> I also know time() is returning the correct epoch time (I've compared it
> with
https://www.epochconverter.com/)
>
> a) Shouldnt the strftime() call return "14:32:19 +1100" - which would fix
> the when_written value. (The message renders with a "written 12hrs ago"
> statement).
You shouldn't use the 'date' property unless you have to. Either use the default (current date/time and zone) are set the when_written_time and when_written_zone header fields instead.
> b) Shouldnt the when_imported by "02:32:19 UTC" (if it is recording
> timestamps in UTC, or 14:32:19 UTC+1100 if rendering local time)?
>
> c) AU is GMT+11 right now (summer time, normally GMT+10), so system time is
> 14:32 - not sure when strftime is returning 02:32 (12 hrs earlier)
>
> Incidently, I used %Z in the strftime() call (instead of %z), which results
> in AEDT (right now) - and it resulted in a when_written of:
>
> when_written 3A24FDD0 0000 Thu Nov 30 00:00:00 2000 UTC
>
> date = strftime("%a, %d %b %Y %I:%M:%S %Z");
> // Tue, 17 Dec 2024 02:28:01 AEDT
>
> I guess save_msg() date parsing doesnt understand AEDT?
No, it doesn't.
--
digital man (rob)
Synchronet/BBS Terminology Definition #83:
TCP = Transmission Control Protocol
Norco, CA WX: 53.2�F, 63.0% humidity, 0 mph E wind, 0.00 inches rain/24hrs