Subj : JS Object save_msg()
To   : deon
From : Digital Man
Date : Tue Dec 17 2024 11:44 am

 Re: JS Object save_msg()
 By: deon to Digital Man on Wed Dec 18 2024 12:27 am

>  >  > 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?
>
> Yes - I'm setting the time of some messages to the same time of a file
> (obtained by new File().date - which also is returning a time_t)

Then you'd want to set the when_written_time property of the message header object being passed to MsgBase.save_msg() with that time_t value.

>  > 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.
>
> OK, I'll try. What is a valid use case of using the "date" property - I'm
> curious since it is a valid argument?

The "date" property is used when importing messages from an RFC822-formatted source/protocol (e.g. SMTP, NNTP, IMAP).

>  >  > date = strftime("%a, %d %b %Y %I:%M:%S %z",time());
>  >  > // Tue, 17 Dec 2024 02:32:19 +1100
>  >  > 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).
>
> I'm still wondering why strftime() is still returning an invalid time - out
> by the timezone plus 1 hr?

The JS strftime() function is just a wrapper for the C run-time library function of the same name. So depending on your OS, you can either run "man strftime" or see https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l to read more up on how strftime() works for your platform.
--
                                           digital man (rob)

Synchronet/BBS Terminology Definition #20:
DCE = Data Communications Equipment (or Deuce, Stephen Hurd)
Norco, CA WX: 73.6�F, 27.0% humidity, 1 mph SE wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net