[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53909] localtime() does not access TZ on wind
From: |
Ian McCallion |
Subject: |
[Octave-bug-tracker] [bug #53909] localtime() does not access TZ on windows |
Date: |
Tue, 15 May 2018 08:14:25 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?53909>
Summary: localtime() does not access TZ on windows
Project: GNU Octave
Submitted by: ianmcc
Submitted on: Tue 15 May 2018 12:14:24 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.0
Operating System: Microsoft Windows
_______________________________________________________
Details:
This script should produce different values for t1, t2 and t3 because they
should be representing the current time in three different timezones (unless
you are already in CST of course):
x = time ();
t1 = localtime (x)
setenv TZ UTC0
t2 = localtime (x)
setenv TZ CST6CDT
t3 = localtime (x)
unsetenv TZ
The script works on unix versions of Octave, but at least on Octave Windows
4.2.2 and 4.4.0, after running this t1==t2==t3=
usec = 140346
sec = 41
min = 35
hour = 8
mday = 12
mon = 4
year = 118
wday = 6
yday = 131
isdst = 1
gmtoff = 0
zone = GMT Daylight Time
This next script however DOES produce correct values for t1, t2 and t3.
x = time ();
t1 = localtime (x)
setenv TZ UTC0
mktime(localtime(1)); % Force Octave to access the TZ environment
variable
t2 = localtime (x)
setenv TZ CST6CDT
mktime(localtime(1)); % Force Octave to access the TZ environment
variable
t3 = localtime (x)
unsetenv TZ
mktime(localtime(1)); % Force Octave to access the TZ environment
variable
The reason this works and the first script didn't is probably a bug that the
posix layer shipped with windows versions of Octave where tzset() is not
called by localtime() and possible other timezone-dependent functions. If
necessary (i.e. can't fix the posix layer) it should be fixed in Octave, by
explicitly calling tzset wherever it may be needed.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53909>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #53909] localtime() does not access TZ on windows,
Ian McCallion <=