Modify

Opened 8 weeks ago

Last modified 7 weeks ago

#4029 new Bug

_Date_Time_SystemTimeToDateTimeStr() wrong output

Reported by: jchd18 Owned by:
Milestone: Component: Standard UDFs
Version: 3.3.14.0 Severity: None
Keywords: Cc:

Description (last modified by jchd18)

The function _Date_Time_SystemTimeToDateTimeStr() has two related but distinct bugs.

Note: the timestamp returned by _Date_Time_GetSystemTime() is raw UTC.

Local $tST = _Date_Time_GetSystemTime()
ConsoleWrite(_Date_Time_SystemTimeToDateTimeStr($tST, 1, 0) & @LF)
ConsoleWrite(_Date_Time_SystemTimeToDateTimeStr($tST, 1, 1) & @LF)

produces the same output:

2024/09/26 12:23:46
2024/09/26 12:23:46

but the first should be shifted by timezone and DST settings. (I'm in France and currently UTC+02:00.)

Local $tST = _Date_Time_GetSystemTime()
ConsoleWrite(_Date_Time_SystemTimeToDateTimeStr($tST, 3, 0) & @LF)
ConsoleWrite(_Date_Time_SystemTimeToDateTimeStr($tST, 3, 1) & @LF)

produces a very wrong output:

2024-09-26T12:30:29-02:00
2024-09-26T12:30:29Z

The second output correctly displays the UTC time.
The first line has YMDhms wrong by 2 hours and timeshift should read "+02:00", hence the first line should be showing local time with offset from UTC, like this:

2024-09-26T14:30:29+02:00

The above reads "it's 14:30:29 local time, and offset from UTC is +2h". To compute UTC from that, one must subtract the offset from the timestamp.

The help file is ambiguous and even wrong on the role of parameter $iType.

Attachments (0)

Change History (5)

comment:1 Changed 8 weeks ago by jchd18

  • Component changed from AutoIt to Standard UDFs

comment:2 Changed 8 weeks ago by jchd18

  • Description modified (diff)

comment:3 Changed 8 weeks ago by jchd18

  • Description modified (diff)

comment:4 Changed 8 weeks ago by Jpm

Hi,
Thanks for the ticket but do you have a fix to propose?

comment:5 Changed 8 weeks ago by jchd18

Hi Jpm,
I'll have a look at it. But I first need to finish my own timescale UDF and, trust me, it isn't just cake.

Version 0, edited 8 weeks ago by jchd18 (next)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.