bugGNU Octave - Bugs: bug #54193, [MXE-Octave]...

 
 

bug #54193: [MXE-Octave] libinterp/corefcn/time.cc-tst failure when test suite is run twice

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Wed 27 Jun 2018 04:21:21 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Closed
Release:  * 4.4.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 29 Jun 2018 02:34:04 PM UTC, comment #5: 

In that case, I'm closing this report as a duplicate of bug #53909.

John W. Eaton <jwe>
Group administrator
Thu 28 Jun 2018 08:34:09 PM UTC, comment #4: 

If calling mktime fixes this bug, then it is a clear duplicate of bug #53909.

Mike Miller <mtmiller>
Group Member
Thu 28 Jun 2018 08:09:18 PM UTC, comment #3: 

I think this might be related to bug #53909 and/or bug #53922.

These are both confirmed bugs on Windows. One is that unsetenv does not unset the environment variable. The second is that changing the TZ environment variable does not have an immediate effect, certain functions do not call tzset(3) as they do on GNU/Linux systems.

Mike Miller <mtmiller>
Group Member
Thu 28 Jun 2018 04:35:39 PM UTC, comment #2: 

This appears to be a timezone problem.  See also bug #53909 and bug #53916.

It seems that datenum sets the timezone to UTC and mktime sets it to the timezone set for the system.  When the timezone changes, localtime also shows a different value for the hour field, as I think it should.  I haven't tried to understand why the mktime function then produces a different result compared to the original value returned from the time function given that the hour value is changed along with the timezone.

In any case, here is what I see:


>> t = time ();
>> localtime (t)
ans =

  scalar structure containing the fields:

    usec =  847215
    sec =  2
    min =  50
    hour =  8
    mday =  28
    mon =  5
    year =  118
    wday =  4
    yday =  178
    isdst =  1
    gmtoff = 0
    zone = Pacific Daylight Time

>> datenum ("5/19/2001")
ans =  730990
>> localtime (t)
ans =

  scalar structure containing the fields:

    usec =  847215
    sec =  2
    min =  50
    hour =  15
    mday =  28
    mon =  5
    year =  118
    wday =  4
    yday =  178
    isdst = 0
    gmtoff = 0
    zone = UTC

>> mktime (localtime (t))
ans =  1530229802.84721
>> localtime (t)
ans =

  scalar structure containing the fields:

    usec =  847215
    sec =  2
    min =  50
    hour =  8
    mday =  28
    mon =  5
    year =  118
    wday =  4
    yday =  178
    isdst =  1
    gmtoff = 0
    zone = Pacific Daylight Time


John W. Eaton <jwe>
Group administrator
Wed 27 Jun 2018 04:48:50 AM UTC, comment #1: 

To be more precise:


>> t = time ();
>> assert (fix (mktime (localtime (t))) == fix (t));
>> datenum ("5/19/2001");
>> t = time ();
>> assert (fix (mktime (localtime (t))) == fix (t));
error: assert (fix (mktime (localtime (t))) == fix (t)) failed
error: called from
    assert at line 92 column 1
>> t = time ();
>> assert (fix (mktime (localtime (t))) == fix (t));
## assert does not fail


Or


>> t = time();
>> datenum ("5/19/2001");
>> fix (mktime (localtime (t))) - fix (t)
ans = -7200
>> t = time();
>> fix (mktime (localtime (t))) - fix (t)
ans = 0


Avinoam Kalma <avinoam>
Group Member
Wed 27 Jun 2018 04:21:21 AM UTC, original submission:  


When running __run_test_suite__ twice, time.cc-tst fails.

The problems is probaly caused by test datenum:


>> test D:\Octave\OCTAVE~3.0\share\octave\4.4.0\etc\tests\libinterp\cor
efcn\time.cc-tst
PASSES 27 out of 27 tests
>> test datenum
PASSES 32 out of 32 tests
>> test D:\Octave\OCTAVE~3.0\share\octave\4.4.0\etc\tests\libinterp\cor
efcn\time.cc-tst
***** test
 t = time ();
 assert (fix (mktime (localtime (t))) == fix (t));
!!!!! test failed
assert (fix (mktime (localtime (t))) == fix (t)) failed
>> test D:\Octave\OCTAVE~3.0\share\octave\4.4.0\etc\tests\libinterp\cor
efcn\time.cc-tst
PASSES 27 out of 27 tests


Avinoam Kalma <avinoam>
Group Member

 

(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 mtmiller (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by avinoam (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-29 jwe StatusNone Duplicate
        Open/ClosedOpen Closed
    2018-06-27 avinoam Summary[MXE-Octave] libinterp/corefcn/time.cc-tst failure t when test suite is run twice [MXE-Octave] libinterp/corefcn/time.cc-tst failure when test suite is run twice

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code