bugGNU Octave - Bugs: bug #53908, Omissions in Documentation of...

 
 

bug #53908: Omissions in Documentation of tm_struct

Submitter:  Ian McCallion <ianmcc>
Submitted:  Tue 15 May 2018 11:50:00 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 20 Dec 2020 01:13:01 PM UTC, comment #5: 

Seems to work for me now.

Closing report.

Markus Mützel <mmuetzel>
Group administrator
Thu 03 Dec 2020 08:38:26 PM UTC, comment #4: 

I pushed a change to default here:
https://hg.savannah.gnu.org/hgweb/octave/rev/eacd1a3417c3

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Tue 15 May 2018 07:21:57 PM UTC, comment #3: 

I think someone with access to Windows will have to try to get something working with GetTimeZoneInformation, GetDynamicTimeZoneInformation, and/or GetTimeZoneInformationForYear. The latter two are not available in older versions of Windows.

I guess this might look something like


GetTimeZoneInformationForYear (tm.tm_year, nullptr, &tzi);
if (tm.tm_isdst)
  tm.tm_gmtoff = -60 * (tzi.Bias + tzi.DaylightBias);
else
  tm.tm_gmtoff = -60 * (tzi.Bias + tzi.StandardBias);


but that's just off the top of my head without ever having used these functions before.

Mike Miller <mtmiller>
Group Member
Tue 15 May 2018 06:21:01 PM UTC, comment #2: 

Looking on MSDN, the aptly named GetTimeZoneInformation function seems to fit the bill.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724421(v=vs.85).aspx

Ian McCallion <ianmcc>
Tue 15 May 2018 05:43:02 PM UTC, comment #1: 

The value of gmtoff is meant to be the number of seconds offset between your local time and UTC, so in your case it ought to be 3600.

I think we would be happy to add support to fill in this offset if it is at all possible with the Windows API. If there is a way to get that information for a given time value, it can be added. Otherwise we should document that it is not implemented on some systems.

Mike Miller <mtmiller>
Group Member
Tue 15 May 2018 11:50:00 AM UTC, original submission:  

A. I'm in the UK and on Windows (4.2.2 and 4.4.0):

> >> localtime(time)
>     usec =  178342
>     sec =  59
>     min =  32
>     hour =  8
>     mday =  12
>     mon =  4
>     year =  118
>     wday =  6
>     yday =  131
>     isdst =  1
>     gmtoff = 0
>     zone = GMT Daylight Time

Clearly gmtoff should be 1 as it is currently daylight time.

I would suggest this is a code bug. However I have been asked to submit it as a documentation bug with the fix being to state at the start of section 36.1 of the manual that gmtoff is not implemented in Windows.

B. The mktime function takes a tm_struct as parameter. However the values for gmtoff and zone are ignored. This is working as designed (because mktime uses the TZ environment variable to obtain timezone information). This fact should be mentioned in the documentation.

Ian McCallion <ianmcc>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by ianmcc (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-20 mmuetzel CategoryDocumentation Interpreter
        Item GroupDocumentation Incorrect Result
        StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-12-03 mtmiller Carbon-CopyRemoved 80942 -
    2020-12-03 mmuetzel Operating SystemAny Microsoft Windows
    2020-12-03 mmuetzel StatusNone Ready For Test
        Release4.4.0 dev

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code