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
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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
time.c
dlls/kernel32/time.c
+23
-27
No files found.
dlls/kernel32/time.c
View file @
3593f7da
...
...
@@ -146,7 +146,7 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
*
* PARAMS
* 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.
*
* RETURNS
...
...
@@ -156,14 +156,13 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
*/
static
DWORD
TIME_CompTimeZoneID
(
const
TIME_ZONE_INFORMATION
*
pTZinfo
,
FILETIME
*
lpFileT
ime
,
BOOL
islocal
)
LONGLONG
t
ime
,
BOOL
islocal
)
{
int
ret
,
year
;
BOOL
beforeStandardDate
,
afterDaylightDate
;
DWORD
retval
=
TIME_ZONE_ID_INVALID
;
LONGLONG
llTime
=
0
;
/* initialized to prevent gcc complaining */
SYSTEMTIME
SysTime
;
FILETIME
ft
Temp
;
FILETIME
ft
;
if
(
pTZinfo
->
DaylightDate
.
wMonth
!=
0
)
{
...
...
@@ -181,20 +180,17 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
return
TIME_ZONE_ID_INVALID
;
}
if
(
!
islocal
)
{
llTime
=
filetime_to_longlong
(
lpFileTime
);
llTime
-=
pTZinfo
->
Bias
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
llTime
,
&
ftTemp
);
lpFileTime
=
&
ftTemp
;
}
if
(
!
islocal
)
time
-=
pTZinfo
->
Bias
*
(
LONGLONG
)
600000000
;
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
longlong_to_filetime
(
time
,
&
ft
);
FileTimeToSystemTime
(
&
ft
,
&
SysTime
);
year
=
SysTime
.
wYear
;
if
(
!
islocal
)
{
llT
ime
-=
pTZinfo
->
DaylightBias
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
llTime
,
&
ftTemp
);
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
t
ime
-=
pTZinfo
->
DaylightBias
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
time
,
&
ft
);
FileTimeToSystemTime
(
&
ft
,
&
SysTime
);
}
/* check for daylight savings */
...
...
@@ -208,14 +204,13 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
beforeStandardDate
=
SysTime
.
wYear
<
year
;
if
(
!
islocal
)
{
llTime
-=
(
pTZinfo
->
StandardBias
-
pTZinfo
->
DaylightBias
)
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
llTime
,
&
ftTemp
);
FileTimeToSystemTime
(
lpFileTime
,
&
SysTime
);
time
-=
(
pTZinfo
->
StandardBias
-
pTZinfo
->
DaylightBias
)
*
(
LONGLONG
)
600000000
;
longlong_to_filetime
(
time
,
&
ft
);
FileTimeToSystemTime
(
&
ft
,
&
SysTime
);
}
if
(
year
==
SysTime
.
wYear
)
{
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
DaylightDate
);
ret
=
TIME_DayLightCompareDate
(
&
SysTime
,
&
pTZinfo
->
DaylightDate
);
if
(
ret
==
-
2
)
return
TIME_ZONE_ID_INVALID
;
...
...
@@ -254,9 +249,10 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
*/
static
DWORD
TIME_ZoneID
(
const
TIME_ZONE_INFORMATION
*
pTzi
)
{
FILETIME
ftTime
;
GetSystemTimeAsFileTime
(
&
ftTime
);
return
TIME_CompTimeZoneID
(
pTzi
,
&
ftTime
,
FALSE
);
LARGE_INTEGER
now
;
NtQuerySystemTime
(
&
now
);
return
TIME_CompTimeZoneID
(
pTzi
,
now
.
QuadPart
,
FALSE
);
}
/***********************************************************************
...
...
@@ -266,7 +262,7 @@ static DWORD TIME_ZoneID( const TIME_ZONE_INFORMATION *pTzi )
*
* PARAMS
* 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.
* pBias [out] The calculated bias in minutes.
*
...
...
@@ -274,10 +270,10 @@ static DWORD TIME_ZoneID( const TIME_ZONE_INFORMATION *pTzi )
* TRUE when the time zone bias was calculated.
*/
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
;
DWORD
tzid
=
TIME_CompTimeZoneID
(
pTZinfo
,
lpFileTime
,
islocal
);
DWORD
tzid
=
TIME_CompTimeZoneID
(
pTZinfo
,
time
,
islocal
);
if
(
tzid
==
TIME_ZONE_ID_INVALID
)
return
FALSE
;
...
...
@@ -700,7 +696,7 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime(
if
(
!
SystemTimeToFileTime
(
lpUniversalTime
,
&
ft
))
return
FALSE
;
llTime
=
filetime_to_longlong
(
&
ft
);
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
&
ft
,
FALSE
,
&
lBias
))
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
llTime
,
FALSE
,
&
lBias
))
return
FALSE
;
/* convert minutes to 100-nanoseconds-ticks */
llTime
-=
(
LONGLONG
)
lBias
*
600000000
;
...
...
@@ -745,7 +741,7 @@ BOOL WINAPI TzSpecificLocalTimeToSystemTime(
if
(
!
SystemTimeToFileTime
(
lpLocalTime
,
&
ft
))
return
FALSE
;
t
=
filetime_to_longlong
(
&
ft
);
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
&
f
t
,
TRUE
,
&
lBias
))
if
(
!
TIME_GetTimezoneBias
(
&
tzinfo
,
t
,
TRUE
,
&
lBias
))
return
FALSE
;
/* convert minutes to 100-nanoseconds-ticks */
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