Subj : JS Object save_msg() To : deon From : Digital Man Date : Thu Dec 19 2024 11:43:46 Re: JS Object save_msg() By: deon to Digital Man on Thu Dec 19 2024 08:45 pm > Following on from my previous message, I think I understand what is going on > - doesnt make sense to me why, but I get it. > > I raised this thread, because a message I just saved with save_msg(), when > immediately read would display a message of "11hrs from now". > > I looked further into the code, and understand what age_of_posted_item() > with smb_tzutc() is doing. > > When Sync starts, xpTimeZone_local() shows the offset from UTC, and sends a > warning message on the console on startup, in my case its 660. Right, and that startup warning was to hopefully avoid configuration issues like you observed ("11hrs from now"). > When saving a message with save_msg(), when_written_time, is populated with > time() if no value is provided, which is the UTC time when the function is > called. > > When displaying the message, the age is calculated between the value of > when_written_time (which is utc), and time() [utc] minus xpTimeZone_local() > plus an offset (which might be negative) derived from scfg -> System -> > Local Time Zone. The "Local Time Zone" is only used for locally posted messages. For messages imported from a network, the when_written_zone is often not the same as your local time zone. > Since I had UTC there, it would be zero, so the age of the > messages is immediately 660s old (utc minus 660 plus 0). > > Thus when when scfg -> System ->Local Time Zone equals xpTimeZone_Local(), > they cancel each other out and age_of_posted_item() is truely however many > seconds ago the message was stored. (utc minus 660 plus 660). > > If this is what is intended, then OK, I get it. Why somebody would find this > useful I guess I dont understand. Synchronet's been evolving since 1990, so not every feature or design decision is obvious. I don't know that it would be useful for a sysop to have a mismatch between the UTC offset of their configured local time zone (in SCFG) and their system time zone. Clearly, such a system could present surprising results in some situations; you pointed one out, but there are probably more. That startup warning message should probably be elevated to an error message. -- digital man (rob) Rush quote #9: One likes to believe in the freedom of ... baseball! Norco, CA WX: 81.5øF, 14.0% humidity, 1 mph NE wind, 0.00 inches rain/24hrs --- SBBSecho 3.23-Linux * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705) .