Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
4ca34c4b
Commit
4ca34c4b
authored
Oct 25, 2004
by
Rein Klazes
Committed by
Alexandre Julliard
Oct 25, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly use the returned value from GetTimeZoneInformation.
parent
c41d0c9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
time.c
dlls/msvcrt/tests/time.c
+13
-6
time.c
dlls/msvcrt/time.c
+4
-2
No files found.
dlls/msvcrt/tests/time.c
View file @
4ca34c4b
...
...
@@ -57,9 +57,11 @@ static void test_mktime()
char
TZ_env
[
256
];
int
secs
;
ok
(
res
!=
0
,
"GetTimeZoneInformation faile
\n
"
);
ok
(
res
!=
TIME_ZONE_ID_INVALID
,
"GetTimeZoneInformation failed
\n
"
);
/* Bias may be positive or negative, to use offset of one day */
secs
=
SECSPERDAY
-
tzinfo
.
Bias
*
SECSPERMIN
;
secs
=
SECSPERDAY
-
(
tzinfo
.
Bias
+
(
res
==
TIME_ZONE_ID_STANDARD
?
tzinfo
.
StandardBias
:
(
res
==
TIME_ZONE_ID_DAYLIGHT
?
tzinfo
.
DaylightBias
:
0
)))
*
SECSPERMIN
;
my_tm
.
tm_mday
=
1
+
secs
/
SECSPERDAY
;
secs
=
secs
%
SECSPERDAY
;
my_tm
.
tm_hour
=
secs
/
SECSPERHOUR
;
...
...
@@ -87,15 +89,19 @@ static void test_localtime()
{
TIME_ZONE_INFORMATION
tzinfo
;
DWORD
res
=
GetTimeZoneInformation
(
&
tzinfo
);
time_t
gmt
=
(
time_t
)(
SECSPERDAY
+
tzinfo
.
Bias
*
SECSPERMIN
);
time_t
gmt
=
(
time_t
)(
SECSPERDAY
+
(
tzinfo
.
Bias
+
(
res
==
TIME_ZONE_ID_STANDARD
?
tzinfo
.
StandardBias
:
(
res
==
TIME_ZONE_ID_DAYLIGHT
?
tzinfo
.
DaylightBias
:
0
)))
*
SECSPERMIN
);
char
TZ_env
[
256
];
struct
tm
*
lt
;
ok
(
res
!=
0
,
"GetTimeZoneInformation faile
\n
"
);
ok
(
res
!=
TIME_ZONE_ID_INVALID
,
"GetTimeZoneInformation failed
\n
"
);
lt
=
localtime
(
&
gmt
);
ok
(((
lt
->
tm_year
==
70
)
&&
(
lt
->
tm_mon
==
0
)
&&
(
lt
->
tm_yday
==
1
)
&&
(
lt
->
tm_mday
==
2
)
&&
(
lt
->
tm_wday
==
5
)
&&
(
lt
->
tm_hour
==
0
)
&&
(
lt
->
tm_min
==
0
)
&&
(
lt
->
tm_sec
==
0
)
&&
(
lt
->
tm_isdst
==
0
)),
(
lt
->
tm_min
==
0
)
&&
(
lt
->
tm_sec
==
0
)
&&
(
lt
->
tm_isdst
==
(
res
==
TIME_ZONE_ID_DAYLIGHT
))),
"Wrong date:Year %4d mon %2d yday %3d mday %2d wday %1d hour%2d min %2d sec %2d dst %2d
\n
"
,
lt
->
tm_year
,
lt
->
tm_mon
,
lt
->
tm_yday
,
lt
->
tm_mday
,
lt
->
tm_wday
,
lt
->
tm_hour
,
lt
->
tm_min
,
lt
->
tm_sec
,
lt
->
tm_isdst
);
...
...
@@ -105,7 +111,8 @@ static void test_localtime()
lt
=
localtime
(
&
gmt
);
ok
(((
lt
->
tm_year
==
70
)
&&
(
lt
->
tm_mon
==
0
)
&&
(
lt
->
tm_yday
==
1
)
&&
(
lt
->
tm_mday
==
2
)
&&
(
lt
->
tm_wday
==
5
)
&&
(
lt
->
tm_hour
==
0
)
&&
(
lt
->
tm_min
==
0
)
&&
(
lt
->
tm_sec
==
0
)
&&
(
lt
->
tm_isdst
==
0
)),
(
lt
->
tm_min
==
0
)
&&
(
lt
->
tm_sec
==
0
)
&&
(
lt
->
tm_isdst
==
(
res
==
TIME_ZONE_ID_DAYLIGHT
))),
"Wrong date:Year %4d mon %2d yday %3d mday %2d wday %1d hour%2d min %2d sec %2d dst %2d
\n
"
,
lt
->
tm_year
,
lt
->
tm_mon
,
lt
->
tm_yday
,
lt
->
tm_mday
,
lt
->
tm_wday
,
lt
->
tm_hour
,
lt
->
tm_min
,
lt
->
tm_sec
,
lt
->
tm_isdst
);
...
...
dlls/msvcrt/time.c
View file @
4ca34c4b
...
...
@@ -124,7 +124,7 @@ struct MSVCRT_tm* MSVCRT_localtime(const MSVCRT_time_t* secs)
tzid
=
GetTimeZoneInformation
(
&
tzinfo
);
if
(
tzid
==
TIME_ZONE_ID_UNKNOWN
)
{
if
(
tzid
==
TIME_ZONE_ID_UNKNOWN
||
tzid
==
TIME_ZONE_ID_INVALID
)
{
tm
.
tm_isdst
=
-
1
;
}
else
{
tm
.
tm_isdst
=
(
tzid
==
TIME_ZONE_ID_DAYLIGHT
?
1
:
0
);
...
...
@@ -234,7 +234,9 @@ void _ftime(struct MSVCRT__timeb *buf)
buf
->
time
=
time
/
TICKSPERSEC
-
SECS_1601_TO_1970
;
buf
->
millitm
=
(
time
%
TICKSPERSEC
)
/
TICKSPERMSEC
;
buf
->
timezone
=
tzinfo
.
Bias
;
buf
->
timezone
=
tzinfo
.
Bias
+
(
tzid
==
TIME_ZONE_ID_STANDARD
?
tzinfo
.
StandardBias
:
(
tzid
==
TIME_ZONE_ID_DAYLIGHT
?
tzinfo
.
DaylightBias
:
0
));
buf
->
dstflag
=
(
tzid
==
TIME_ZONE_ID_DAYLIGHT
?
1
:
0
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment