Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
64ed8487
Commit
64ed8487
authored
Feb 26, 2004
by
Huw Davies
Committed by
Alexandre Julliard
Feb 26, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call TIME_GetBias rather than RtlQueryTimeZoneInfo if we're only
interested in the bias - it's faster.
parent
b65d1360
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
29 deletions
+33
-29
time.c
dlls/ntdll/time.c
+33
-29
No files found.
dlls/ntdll/time.c
View file @
64ed8487
...
...
@@ -257,8 +257,6 @@ static const struct tagTZ_INFO TZ_INFO[] =
'e'
,
'\0'
},
-
780
,
0
}
};
/*********** start of code by Rex Jolliff (rex@lvcablemodem.com) **************/
#define TICKSPERSEC 10000000
#define TICKSPERMSEC 10000
#define SECSPERDAY 86400
...
...
@@ -469,6 +467,27 @@ BOOLEAN WINAPI RtlTimeFieldsToTime(
return
TRUE
;
}
/***********************************************************************
* TIME_GetBias [internal]
*
* Helper function calculates delta local time from UTC.
*
* PARAMS
* utc [I] The current utc time.
* pdaylight [I] Local daylight.
*
* RETURNS
* The bias for the current timezone.
*/
static
int
TIME_GetBias
(
time_t
utc
,
int
*
pdaylight
)
{
struct
tm
*
ptm
=
localtime
(
&
utc
);
*
pdaylight
=
ptm
->
tm_isdst
;
/* daylight for local timezone */
ptm
=
gmtime
(
&
utc
);
ptm
->
tm_isdst
=
*
pdaylight
;
/* use local daylight, not that of Greenwich */
return
(
int
)(
utc
-
mktime
(
ptm
));
}
/******************************************************************************
* RtlLocalTimeToSystemTime [NTDLL.@]
*
...
...
@@ -485,12 +504,15 @@ BOOLEAN WINAPI RtlTimeFieldsToTime(
NTSTATUS
WINAPI
RtlLocalTimeToSystemTime
(
const
LARGE_INTEGER
*
LocalTime
,
PLARGE_INTEGER
SystemTime
)
{
TIME_ZONE_INFORMATION
tzinfo
;
time_t
gmt
;
int
bias
,
daylight
;
TRACE
(
"(%p, %p)
\n
"
,
LocalTime
,
SystemTime
);
RtlQueryTimeZoneInformation
(
&
tzinfo
);
SystemTime
->
QuadPart
=
LocalTime
->
QuadPart
+
tzinfo
.
Bias
*
60
*
(
LONGLONG
)
10000000
;
gmt
=
time
(
NULL
);
bias
=
TIME_GetBias
(
gmt
,
&
daylight
);
SystemTime
->
QuadPart
=
LocalTime
->
QuadPart
-
bias
*
(
LONGLONG
)
10000000
;
return
STATUS_SUCCESS
;
}
...
...
@@ -510,12 +532,15 @@ NTSTATUS WINAPI RtlLocalTimeToSystemTime( const LARGE_INTEGER *LocalTime,
NTSTATUS
WINAPI
RtlSystemTimeToLocalTime
(
const
LARGE_INTEGER
*
SystemTime
,
PLARGE_INTEGER
LocalTime
)
{
TIME_ZONE_INFORMATION
tzinfo
;
time_t
gmt
;
int
bias
,
daylight
;
TRACE
(
"(%p, %p)
\n
"
,
SystemTime
,
LocalTime
);
RtlQueryTimeZoneInformation
(
&
tzinfo
);
LocalTime
->
QuadPart
=
SystemTime
->
QuadPart
-
tzinfo
.
Bias
*
60
*
(
LONGLONG
)
10000000
;
gmt
=
time
(
NULL
);
bias
=
TIME_GetBias
(
gmt
,
&
daylight
);
LocalTime
->
QuadPart
=
SystemTime
->
QuadPart
+
bias
*
(
LONGLONG
)
10000000
;
return
STATUS_SUCCESS
;
}
...
...
@@ -659,27 +684,6 @@ NTSTATUS WINAPI NtQuerySystemTime( PLARGE_INTEGER Time )
}
/***********************************************************************
* TIME_GetBias [internal]
*
* Helper function calculates delta local time from UTC.
*
* PARAMS
* utc [I] The current utc time.
* pdaylight [I] Local daylight.
*
* RETURNS
* The bias for the current timezone.
*/
static
int
TIME_GetBias
(
time_t
utc
,
int
*
pdaylight
)
{
struct
tm
*
ptm
=
localtime
(
&
utc
);
*
pdaylight
=
ptm
->
tm_isdst
;
/* daylight for local timezone */
ptm
=
gmtime
(
&
utc
);
ptm
->
tm_isdst
=
*
pdaylight
;
/* use local daylight, not that of Greenwich */
return
(
int
)(
utc
-
mktime
(
ptm
));
}
/***********************************************************************
* TIME_GetTZAsStr [internal]
*
* Helper function that returns the given timezone as a string.
...
...
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