bugGNU Octave - Bugs: bug #48858, datenum gives wrong results at...

 
 

bug #48858: datenum gives wrong results at daylight saving time switchover period in spring

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Mon 22 Aug 2016 02:45:47 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Mon 22 Aug 2016 04:53:44 PM UTC, comment #1: 

This has been reported quite a while ago as bug #36954 and bug #37798. Closing as a duplicate.

Mike Miller <mtmiller>
Group Member
Mon 22 Aug 2016 02:45:47 PM UTC, original submission:  

Octave:

>> format long
>> datenum ('2015-03-29 02:30', 'yyyy-mm-dd HH:MM')
ans =  736052.145833333
>> datestr (datenum ('2015-03-29 02:30', 'yyyy-mm-dd HH:MM'), 0)
ans = 29-Mar-2015 03:30:00


while Matlab (r2012a) gives:

>> format long
>> datenum ('2015-03-29 02:30', 'yyyy-mm-dd HH:MM')
ans =
     7.360521041666666e+05
>> datestr (datenum ('2015-03-29 02:30', 'yyyy-mm-dd HH:MM'), 0)
ans =
29-Mar-2015 02:30:00



That Octave's datestr works correctly can be seen more clearly by filling in Matlab's answer for
datenum ('2015-03-29 02:30', 'yyyy-mm-dd HH:MM'):

>> datestr ( 7.360521041666666e+05, 0)
ans = 29-Mar-2015 02:30:00


AFAICS (after processing several years of 10-minute tidal observations) is that this only happens during spring, when time changes from "winter time" to "summer time" / daylight saving time, in the period between 01:59.59 AM and 02:59:59 AM.

IOW, applying
datestr (datenum (vdates, 'yyyy-mm-dd HH:MM'), 0)
to the following array of strings (vdates):

2015-03-29 01:30
2015-03-29 01:40
2015-03-29 01:50
2015-03-29 02:00
2015-03-29 02:10
2015-03-29 02:20
2015-03-29 02:30
2015-03-29 02:40
2015-03-29 02:50
2015-03-29 03:00
2015-03-29 03:10
2015-03-29 03:20
2015-03-29 03:30


gives

29-Mar-2015 01:30:00
29-Mar-2015 01:40:00
29-Mar-2015 01:50:00
29-Mar-2015 03:00:00
29-Mar-2015 03:10:00
29-Mar-2015 03:20:00
29-Mar-2015 03:30:00
29-Mar-2015 03:40:00
29-Mar-2015 03:50:00
29-Mar-2015 03:00:00
29-Mar-2015 03:10:00
29-Mar-2015 03:20:00
29-Mar-2015 03:30:00



I found this bug also in Octave-3.8.2.

Philip Nienhuis <philipnienhuis>
Group Member

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

Digest:
   bug dependencies.

No items depend on this one.

 

Mail Notification Carbon-Copy List

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

    Votes

    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.

     

    History

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-22 mtmiller StatusNone Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #36954

    Back to the top

    Powered by Savane 3.16-ed84.
    Corresponding source code