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
3593f7da
Commit
3593f7da
authored
May 15, 2019
by
Huw Davies
Committed by
Alexandre Julliard
May 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Simplify TIME_CompTimeZoneID() by passing time as LONGLONG.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9fbfcbe1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
28 deletions
+24
-28
time.c
dlls/kernel32/time.c
+24
-28
No files found.
dlls/kernel32/time.c
View file @
3593f7da
...
@@ -146,7 +146,7 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
...
@@ -146,7 +146,7 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
*
*
* PARAMS
* PARAMS
* pTZinfo [in] The time zone data.
* pTZinfo [in] The time zone data.
*
lpFileTime
[in] The system or local time.
*
time
[in] The system or local time.
* islocal [in] it is local time.
* islocal [in] it is local time.
*
*
* RETURNS
* RETURNS
...
@@ -156,14 +156,13 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
...
@@ -156,14 +156,13 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
*/
*/
static
DWORD
TIME_CompTimeZoneID
(
const
TIME_ZONE_INFORMATION
*
pTZinfo
,
static
DWORD
TIME_CompTimeZoneID
(
const
TIME_ZONE_INFORMATION
*
pTZinfo
,
FILETIME
*
lpFileT
ime
,
BOOL
islocal
)
LONGLONG
t
ime
,
BOOL
islocal
)
{
{
int
ret
,
year
;
int
ret
,
year
;
BOOL
beforeStandardDate
,
afterDaylightDate
;
BOOL
beforeStandardDate
,
afterDaylightDate
;
DWORD
retval
=
TIME_ZONE_ID_INVALID
;
DWORD
retval
=
TIME_ZONE_ID_INVALID
;
LONGLONG
llTime
=
0
;
/* initialized to prevent gcc complaining */
SYSTEMTIME
SysTime
;
SYSTEMTIME
SysTime
;
FILETIME
ft
Temp
;
FILETIME
ft
;
if
(
pTZinfo
->
DaylightDate
.
wMonth
!=
0
)
if
(
pTZinfo
->
DaylightDate
.
wMonth
!=
0
)
{
{
...
@@ -181,20 +180,17 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
...
@@ -181,20 +180,17 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
return
TIME_ZONE_ID_INVALID
;
return
TIME_ZONE_ID_INVALID
;
}
}
if
(
!
islocal
)
{
if
(
!
islocal
)
llTime
=
filetime_to_longlong
(
lpFileTime
);
time
-=
pTZinfo
->
Bias
*
(
LONGLONG
)
600000000
;
llTime
-=
pTZinfo
->
Bias
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
llTime
,
&
ftTemp
);
lpFileTime
=
&
ftTemp
;
}
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
longlong_to_filetime
(
time
,
&
ft
);
FileTimeToSystemTime
(
&
ft
,
&
SysTime
);
year
=
SysTime
.
wYear
;
year
=
SysTime
.
wYear
;
if
(
!
islocal
)
{
if
(
!
islocal
)
{
llT
ime
-=
pTZinfo
->
DaylightBias
*
(
LONGLONG
)
600000000
;
t
ime
-=
pTZinfo
->
DaylightBias
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
llTime
,
&
ftTemp
);
longlong_to_filetime
(
time
,
&
ft
);
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
FileTimeToSystemTime
(
&
ft
,
&
SysTime
);
}
}
/* check for daylight savings */
/* check for daylight savings */
...
@@ -208,14 +204,13 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
...
@@ -208,14 +204,13 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
beforeStandardDate
=
SysTime
.
wYear
<
year
;
beforeStandardDate
=
SysTime
.
wYear
<
year
;
if
(
!
islocal
)
{
if
(
!
islocal
)
{
llTime
-=
(
pTZinfo
->
StandardBias
-
pTZinfo
->
DaylightBias
)
time
-=
(
pTZinfo
->
StandardBias
-
pTZinfo
->
DaylightBias
)
*
(
LONGLONG
)
600000000
;
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
time
,
&
ft
);
longlong_to_filetime
(
llTime
,
&
ftTemp
);
FileTimeToSystemTime
(
&
ft
,
&
SysTime
);
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
}
}
if
(
year
==
SysTime
.
wYear
)
{
if
(
year
==
SysTime
.
wYear
)
{
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
DaylightDate
);
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
DaylightDate
);
if
(
ret
==
-
2
)
if
(
ret
==
-
2
)
return
TIME_ZONE_ID_INVALID
;
return
TIME_ZONE_ID_INVALID
;
...
@@ -224,7 +219,7 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
...
@@ -224,7 +219,7 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
afterDaylightDate
=
SysTime
.
wYear
>
year
;
afterDaylightDate
=
SysTime
.
wYear
>
year
;
retval
=
TIME_ZONE_ID_STANDARD
;
retval
=
TIME_ZONE_ID_STANDARD
;
if
(
pTZinfo
->
DaylightDate
.
wMonth
<
pTZinfo
->
StandardDate
.
wMonth
)
{
if
(
pTZinfo
->
DaylightDate
.
wMonth
<
pTZinfo
->
StandardDate
.
wMonth
)
{
/* Northern hemisphere */
/* Northern hemisphere */
if
(
beforeStandardDate
&&
afterDaylightDate
)
if
(
beforeStandardDate
&&
afterDaylightDate
)
retval
=
TIME_ZONE_ID_DAYLIGHT
;
retval
=
TIME_ZONE_ID_DAYLIGHT
;
...
@@ -254,9 +249,10 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
...
@@ -254,9 +249,10 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
*/
*/
static
DWORD
TIME_ZoneID
(
const
TIME_ZONE_INFORMATION
*
pTzi
)
static
DWORD
TIME_ZoneID
(
const
TIME_ZONE_INFORMATION
*
pTzi
)
{
{
FILETIME
ftTime
;
LARGE_INTEGER
now
;
GetSystemTimeAsFileTime
(
&
ftTime
);
return
TIME_CompTimeZoneID
(
pTzi
,
&
ftTime
,
FALSE
);
NtQuerySystemTime
(
&
now
);
return
TIME_CompTimeZoneID
(
pTzi
,
now
.
QuadPart
,
FALSE
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -266,7 +262,7 @@ static DWORD TIME_ZoneID( const TIME_ZONE_INFORMATION *pTzi )
...
@@ -266,7 +262,7 @@ static DWORD TIME_ZoneID( const TIME_ZONE_INFORMATION *pTzi )
*
*
* PARAMS
* PARAMS
* pTZinfo [in] The time zone data.
* pTZinfo [in] The time zone data.
*
lpFileTime
[in] The system or local time.
*
time
[in] The system or local time.
* islocal [in] It is local time.
* islocal [in] It is local time.
* pBias [out] The calculated bias in minutes.
* pBias [out] The calculated bias in minutes.
*
*
...
@@ -274,10 +270,10 @@ static DWORD TIME_ZoneID( const TIME_ZONE_INFORMATION *pTzi )
...
@@ -274,10 +270,10 @@ static DWORD TIME_ZoneID( const TIME_ZONE_INFORMATION *pTzi )
* TRUE when the time zone bias was calculated.
* TRUE when the time zone bias was calculated.
*/
*/
static
BOOL
TIME_GetTimezoneBias
(
const
TIME_ZONE_INFORMATION
*
pTZinfo
,
static
BOOL
TIME_GetTimezoneBias
(
const
TIME_ZONE_INFORMATION
*
pTZinfo
,
FILETIME
*
lpFileT
ime
,
BOOL
islocal
,
LONG
*
pBias
)
LONGLONG
t
ime
,
BOOL
islocal
,
LONG
*
pBias
)
{
{
LONG
bias
=
pTZinfo
->
Bias
;
LONG
bias
=
pTZinfo
->
Bias
;
DWORD
tzid
=
TIME_CompTimeZoneID
(
pTZinfo
,
lpFileTime
,
islocal
);
DWORD
tzid
=
TIME_CompTimeZoneID
(
pTZinfo
,
time
,
islocal
);
if
(
tzid
==
TIME_ZONE_ID_INVALID
)
if
(
tzid
==
TIME_ZONE_ID_INVALID
)
return
FALSE
;
return
FALSE
;
...
@@ -700,7 +696,7 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime(
...
@@ -700,7 +696,7 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime(
if
(
!
SystemTimeToFileTime
(
lpUniversalTime
,
&
ft
))
if
(
!
SystemTimeToFileTime
(
lpUniversalTime
,
&
ft
))
return
FALSE
;
return
FALSE
;
llTime
=
filetime_to_longlong
(
&
ft
);
llTime
=
filetime_to_longlong
(
&
ft
);
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
&
ft
,
FALSE
,
&
lBias
))
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
llTime
,
FALSE
,
&
lBias
))
return
FALSE
;
return
FALSE
;
/* convert minutes to 100-nanoseconds-ticks */
/* convert minutes to 100-nanoseconds-ticks */
llTime
-=
(
LONGLONG
)
lBias
*
600000000
;
llTime
-=
(
LONGLONG
)
lBias
*
600000000
;
...
@@ -745,7 +741,7 @@ BOOL WINAPI TzSpecificLocalTimeToSystemTime(
...
@@ -745,7 +741,7 @@ BOOL WINAPI TzSpecificLocalTimeToSystemTime(
if
(
!
SystemTimeToFileTime
(
lpLocalTime
,
&
ft
))
if
(
!
SystemTimeToFileTime
(
lpLocalTime
,
&
ft
))
return
FALSE
;
return
FALSE
;
t
=
filetime_to_longlong
(
&
ft
);
t
=
filetime_to_longlong
(
&
ft
);
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
&
f
t
,
TRUE
,
&
lBias
))
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
t
,
TRUE
,
&
lBias
))
return
FALSE
;
return
FALSE
;
/* convert minutes to 100-nanoseconds-ticks */
/* convert minutes to 100-nanoseconds-ticks */
t
+=
(
LONGLONG
)
lBias
*
600000000
;
t
+=
(
LONGLONG
)
lBias
*
600000000
;
...
...
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