Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
e5a25ec5
Commit
e5a25ec5
authored
Dec 10, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fixed TIME_CompTimeZoneID behavior on dates close to New Year's Eve.
parent
b057c5f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
13 deletions
+48
-13
time.c
dlls/kernel32/tests/time.c
+23
-0
time.c
dlls/kernel32/time.c
+25
-13
No files found.
dlls/kernel32/tests/time.c
View file @
e5a25ec5
...
...
@@ -336,6 +336,29 @@ static void test_GetTimeZoneInformation(void)
l_time
=
system_time_to_minutes
(
&
local
);
ok
(
l_time
-
s_time
==
diff
,
"got %d, expected %d
\n
"
,
(
LONG
)(
l_time
-
s_time
),
diff
);
/* test 23:01, 31st of December date */
memset
(
&
tzinfo
,
0
,
sizeof
(
tzinfo
));
tzinfo
.
StandardDate
.
wMonth
=
10
;
tzinfo
.
StandardDate
.
wDay
=
5
;
tzinfo
.
StandardDate
.
wHour
=
2
;
tzinfo
.
StandardDate
.
wMinute
=
0
;
tzinfo
.
DaylightDate
.
wMonth
=
4
;
tzinfo
.
DaylightDate
.
wDay
=
1
;
tzinfo
.
DaylightDate
.
wHour
=
2
;
tzinfo
.
Bias
=
0
;
tzinfo
.
StandardBias
=
0
;
tzinfo
.
DaylightBias
=
-
60
;
utc
.
wYear
=
2012
;
utc
.
wMonth
=
12
;
utc
.
wDay
=
31
;
utc
.
wHour
=
23
;
utc
.
wMinute
=
1
;
res
=
pSystemTimeToTzSpecificLocalTime
(
&
tzinfo
,
&
utc
,
&
local
);
ok
(
res
,
"SystemTimeToTzSpecificLocalTime error %u
\n
"
,
GetLastError
());
ok
(
local
.
wYear
==
2012
&&
local
.
wMonth
==
12
&&
local
.
wDay
==
31
&&
local
.
wHour
==
23
&&
local
.
wMinute
==
1
,
"got (%d-%d-%d %02d:%02d), expected (2012-12-31 23:01)
\n
"
,
local
.
wYear
,
local
.
wMonth
,
local
.
wDay
,
local
.
wHour
,
local
.
wMinute
);
}
static
void
test_FileTimeToSystemTime
(
void
)
...
...
dlls/kernel32/time.c
View file @
e5a25ec5
...
...
@@ -152,7 +152,7 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
static
DWORD
TIME_CompTimeZoneID
(
const
TIME_ZONE_INFORMATION
*
pTZinfo
,
FILETIME
*
lpFileTime
,
BOOL
islocal
)
{
int
ret
;
int
ret
,
year
;
BOOL
beforeStandardDate
,
afterDaylightDate
;
DWORD
retval
=
TIME_ZONE_ID_INVALID
;
LONGLONG
llTime
=
0
;
/* initialized to prevent gcc complaining */
...
...
@@ -177,20 +177,29 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
if
(
!
islocal
)
{
FILETIME2LL
(
lpFileTime
,
llTime
);
llTime
-=
(
pTZinfo
->
Bias
+
pTZinfo
->
DaylightBias
)
*
(
LONGLONG
)
600000000
;
llTime
-=
pTZinfo
->
Bias
*
(
LONGLONG
)
600000000
;
LL2FILETIME
(
llTime
,
&
ftTemp
)
lpFileTime
=
&
ftTemp
;
}
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
/* check for daylight savings */
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
StandardDate
);
if
(
ret
==
-
2
)
return
TIME_ZONE_ID_INVALID
;
year
=
SysTime
.
wYear
;
if
(
!
islocal
)
{
llTime
-=
pTZinfo
->
DaylightBias
*
(
LONGLONG
)
600000000
;
LL2FILETIME
(
llTime
,
&
ftTemp
)
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
}
/* check for daylight savings */
if
(
year
==
SysTime
.
wYear
)
{
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
StandardDate
);
if
(
ret
==
-
2
)
return
TIME_ZONE_ID_INVALID
;
beforeStandardDate
=
ret
<
0
;
beforeStandardDate
=
ret
<
0
;
}
else
beforeStandardDate
=
SysTime
.
wYear
<
year
;
if
(
!
islocal
)
{
llTime
-=
(
pTZinfo
->
StandardBias
-
pTZinfo
->
DaylightBias
)
...
...
@@ -199,11 +208,14 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
}
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
DaylightDate
);
if
(
ret
==
-
2
)
return
TIME_ZONE_ID_INVALID
;
if
(
year
==
SysTime
.
wYear
)
{
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
DaylightDate
);
if
(
ret
==
-
2
)
return
TIME_ZONE_ID_INVALID
;
afterDaylightDate
=
ret
>=
0
;
afterDaylightDate
=
ret
>=
0
;
}
else
afterDaylightDate
=
SysTime
.
wYear
>
year
;
retval
=
TIME_ZONE_ID_STANDARD
;
if
(
pTZinfo
->
DaylightDate
.
wMonth
<
pTZinfo
->
StandardDate
.
wMonth
)
{
...
...
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