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
08922859
Commit
08922859
authored
Aug 19, 2003
by
Jon Griffiths
Committed by
Alexandre Julliard
Aug 19, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make RtlTimeToSecondsSince1970 consistent with other time calls.
Documentation fixes.
parent
47b6d0af
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
67 deletions
+79
-67
time.c
dlls/ntdll/time.c
+78
-66
winternl.h
include/winternl.h
+1
-1
No files found.
dlls/ntdll/time.c
View file @
08922859
...
...
@@ -2,8 +2,8 @@
* Nt time functions.
*
* RtlTimeToTimeFields, RtlTimeFieldsToTime and defines are taken from ReactOS and
* adapted to wine with special permissions of the author
* Rex Jolliff (rex@lvcablemodem.com)
* adapted to wine with special permissions of the author
. This code is
*
Copyright 2002
Rex Jolliff (rex@lvcablemodem.com)
*
* Copyright 1999 Juergen Schmied
*
...
...
@@ -332,11 +332,11 @@ void NTDLL_get_server_timeout( abs_time_t *when, const LARGE_INTEGER *timeout )
/******************************************************************************
* RtlTimeToTimeFields [NTDLL.@]
*
*
Parses Time into a TimeFields
structure.
*
Convert a time into a TIME_FIELDS
structure.
*
* PARAMS
* liTime
[I] Time to convert to timefields
.
* TimeFields [O]
Pointer to TIME_FIELDS structure to hold parsed info
.
* liTime
[I] Time to convert
.
* TimeFields [O]
Destination for the converted time
.
*
* RETURNS
* Nothing.
...
...
@@ -395,15 +395,15 @@ VOID WINAPI RtlTimeToTimeFields(
/******************************************************************************
* RtlTimeFieldsToTime [NTDLL.@]
*
* Convert
s a TIME_FIELDS structure to
time.
* Convert
a TIME_FIELDS structure into a
time.
*
* PARAMS
* ftTimeFields [I] T
ime fields
structure to convert.
* Time
[O] C
onverted time.
* ftTimeFields [I] T
IME_FIELDS
structure to convert.
* Time
[O] Destination for the c
onverted time.
*
* RETURNS
*
TRUE: Successful
.
* F
ALSE: Failure
.
*
Success: TRUE
.
* F
ailure: FALSE
.
*/
BOOLEAN
WINAPI
RtlTimeFieldsToTime
(
PTIME_FIELDS
tfTimeFields
,
...
...
@@ -453,14 +453,15 @@ BOOLEAN WINAPI RtlTimeFieldsToTime(
/******************************************************************************
* RtlLocalTimeToSystemTime [NTDLL.@]
*
* Convert
s local time
to system time.
* Convert
a local time in
to system time.
*
* PARAMS
* LocalTime
[I] Local
time to convert.
* SystemTime [O]
SystemTime of the supplied local
time.
* LocalTime
[I] Local
time to convert.
* SystemTime [O]
Destination for the converted
time.
*
* RETURNS
* Status.
* Success: STATUS_SUCCESS.
* Failure: An NTSTATUS error code indicating the problem.
*/
NTSTATUS
WINAPI
RtlLocalTimeToSystemTime
(
const
LARGE_INTEGER
*
LocalTime
,
PLARGE_INTEGER
SystemTime
)
...
...
@@ -477,14 +478,15 @@ NTSTATUS WINAPI RtlLocalTimeToSystemTime( const LARGE_INTEGER *LocalTime,
/******************************************************************************
* RtlSystemTimeToLocalTime [NTDLL.@]
*
* Convert
s system Time to
local time.
* Convert
a system time into a
local time.
*
* PARAMS
* SystemTime [I] System time to convert.
* LocalTime
[O] Local time of the supplied system
time.
* LocalTime
[O] Destination for the converted
time.
*
* RETURNS
* Nothing.
* Success: STATUS_SUCCESS.
* Failure: An NTSTATUS error code indicating the problem.
*/
NTSTATUS
WINAPI
RtlSystemTimeToLocalTime
(
const
LARGE_INTEGER
*
SystemTime
,
PLARGE_INTEGER
LocalTime
)
...
...
@@ -501,90 +503,96 @@ NTSTATUS WINAPI RtlSystemTimeToLocalTime( const LARGE_INTEGER *SystemTime,
/******************************************************************************
* RtlTimeToSecondsSince1970 [NTDLL.@]
*
* Convert
s Time to
seconds since 1970.
* Convert
a time into a count of
seconds since 1970.
*
* PARAMS
*
time
[I] Time to convert.
*
res [O] Pointer to a LONG to receive the seconds since 1970
.
*
Time
[I] Time to convert.
*
Seconds [O] Destination for the converted time
.
*
* RETURNS
*
TRUE: Successful
.
* F
ALSE: Failure
.
*
Success: TRUE
.
* F
ailure: FALSE, if the resulting value will not fit in a DWORD
.
*/
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
const
LARGE_INTEGER
*
time
,
PULONG
re
s
)
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
const
LARGE_INTEGER
*
Time
,
LPDWORD
Second
s
)
{
ULONGLONG
tmp
=
((
ULONGLONG
)
time
->
s
.
HighPart
<<
32
)
|
t
ime
->
s
.
LowPart
;
ULONGLONG
tmp
=
((
ULONGLONG
)
Time
->
s
.
HighPart
<<
32
)
|
T
ime
->
s
.
LowPart
;
tmp
=
RtlLargeIntegerDivide
(
tmp
,
10000000
,
NULL
);
tmp
-=
SECS_1601_TO_1970
;
if
(
tmp
>
0xffffffff
)
return
FALSE
;
*
re
s
=
(
DWORD
)
tmp
;
*
Second
s
=
(
DWORD
)
tmp
;
return
TRUE
;
}
/******************************************************************************
* RtlTimeToSecondsSince1980 [NTDLL.@]
*
* Convert
s Time to
seconds since 1980.
* Convert
a time into a count of
seconds since 1980.
*
* PARAMS
*
time
[I] Time to convert.
*
res [O] Pointer to a integer to receive the time since 1980
.
*
Time
[I] Time to convert.
*
Seconds [O] Destination for the converted time
.
*
* RETURNS
*
TRUE: Successful
.
* F
ALSE: Failure
.
*
Success: TRUE
.
* F
ailure: FALSE, if the resulting value will not fit in a DWORD
.
*/
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
const
LARGE_INTEGER
*
time
,
LPDWORD
re
s
)
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
const
LARGE_INTEGER
*
Time
,
LPDWORD
Second
s
)
{
ULONGLONG
tmp
=
((
ULONGLONG
)
time
->
s
.
HighPart
<<
32
)
|
t
ime
->
s
.
LowPart
;
ULONGLONG
tmp
=
((
ULONGLONG
)
Time
->
s
.
HighPart
<<
32
)
|
T
ime
->
s
.
LowPart
;
tmp
=
RtlLargeIntegerDivide
(
tmp
,
10000000
,
NULL
);
tmp
-=
SECS_1601_TO_1980
;
if
(
tmp
>
0xffffffff
)
return
FALSE
;
*
re
s
=
(
DWORD
)
tmp
;
*
Second
s
=
(
DWORD
)
tmp
;
return
TRUE
;
}
/******************************************************************************
* RtlSecondsSince1970ToTime [NTDLL.@]
*
* Convert
s seconds since 1970 to
time.
* Convert
a count of seconds since 1970 to a
time.
*
* PARAMS
*
time [I] Seconds since 1970
to convert.
*
res [O] Seconds since 1970 in T
ime.
*
Seconds [I] Time
to convert.
*
Time [O] Destination for the converted t
ime.
*
* RETURNS
* Nothing.
*/
void
WINAPI
RtlSecondsSince1970ToTime
(
DWORD
time
,
LARGE_INTEGER
*
res
)
void
WINAPI
RtlSecondsSince1970ToTime
(
DWORD
Seconds
,
LARGE_INTEGER
*
Time
)
{
ULONGLONG
secs
=
time
*
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1970
;
res
->
s
.
LowPart
=
(
DWORD
)
secs
;
res
->
s
.
HighPart
=
(
DWORD
)(
secs
>>
32
);
ULONGLONG
secs
=
Seconds
*
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1970
;
Time
->
s
.
LowPart
=
(
DWORD
)
secs
;
Time
->
s
.
HighPart
=
(
DWORD
)(
secs
>>
32
);
}
/******************************************************************************
* RtlSecondsSince1980ToTime [NTDLL.@]
*
* Convert
s seconds since 1980 to
time.
* Convert
a count of seconds since 1980 to a
time.
*
* PARAMS
*
time [I] Seconds since 1980
to convert.
*
res [O] Seconds since 1980 in T
ime.
*
Seconds [I] Time
to convert.
*
Time [O] Destination for the converted t
ime.
*
* RETURNS
* Nothing.
*/
void
WINAPI
RtlSecondsSince1980ToTime
(
DWORD
time
,
LARGE_INTEGER
*
res
)
void
WINAPI
RtlSecondsSince1980ToTime
(
DWORD
Seconds
,
LARGE_INTEGER
*
Time
)
{
ULONGLONG
secs
=
time
*
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1980
;
res
->
s
.
LowPart
=
(
DWORD
)
secs
;
res
->
s
.
HighPart
=
(
DWORD
)(
secs
>>
32
);
ULONGLONG
secs
=
Seconds
*
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1980
;
Time
->
s
.
LowPart
=
(
DWORD
)
secs
;
Time
->
s
.
HighPart
=
(
DWORD
)(
secs
>>
32
);
}
/******************************************************************************
* RtlTimeToElapsedTimeFields [NTDLL.@]
*
* Convert a time to a count of elapsed seconds.
*
* PARAMS
* Time [I] Time to convert.
* TimeFields [O] Destination for the converted time.
*
* RETURNS
* Nothing.
*/
...
...
@@ -612,21 +620,22 @@ void WINAPI RtlTimeToElapsedTimeFields( const LARGE_INTEGER *Time, PTIME_FIELDS
* NtQuerySystemTime [NTDLL.@]
* ZwQuerySystemTime [NTDLL.@]
*
* Get
s
the current system time.
* Get the current system time.
*
* PARAMS
*
time [O] T
he current system time.
*
Time [O] Destination for t
he current system time.
*
* RETURNS
* Status.
* Success: STATUS_SUCCESS.
* Failure: An NTSTATUS error code indicating the problem.
*/
NTSTATUS
WINAPI
NtQuerySystemTime
(
PLARGE_INTEGER
t
ime
)
NTSTATUS
WINAPI
NtQuerySystemTime
(
PLARGE_INTEGER
T
ime
)
{
struct
timeval
now
;
gettimeofday
(
&
now
,
0
);
t
ime
->
QuadPart
=
now
.
tv_sec
*
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1970
;
t
ime
->
QuadPart
+=
now
.
tv_usec
*
10
;
T
ime
->
QuadPart
=
now
.
tv_sec
*
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1970
;
T
ime
->
QuadPart
+=
now
.
tv_usec
*
10
;
return
STATUS_SUCCESS
;
}
...
...
@@ -687,19 +696,20 @@ static const WCHAR* TIME_GetTZAsStr (time_t utc, int bias, int dst)
return
TZ_INFO
[
i
].
psTZWindows
;
}
return
(
NULL
)
;
return
NULL
;
}
/***********************************************************************
* RtlQueryTimeZoneInformation [NTDLL.@]
*
*
Returns the
timezone.
*
Get information about the current
timezone.
*
* PARAMS
* tzinfo [O]
Retrieves the
timezone info.
* tzinfo [O]
Destination for the retrieved
timezone info.
*
* RETURNS
* Status.
* Success: STATUS_SUCCESS.
* Failure: An NTSTATUS error code indicating the problem.
*/
NTSTATUS
WINAPI
RtlQueryTimeZoneInformation
(
LPTIME_ZONE_INFORMATION
tzinfo
)
{
...
...
@@ -723,15 +733,16 @@ NTSTATUS WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo)
/***********************************************************************
* RtlSetTimeZoneInformation [NTDLL.@]
*
* Set
s the current time zone
.
* Set
the current time zone information
.
*
* PARAMS
* tzinfo [I] Timezone information
used to set timezone
.
* tzinfo [I] Timezone information
to set
.
*
* RETURNS
* Status.
* Success: STATUS_SUCCESS.
* Failure: An NTSTATUS error code indicating the problem.
*
* BUGS
:
* BUGS
* Uses the obsolete unix timezone structure and tz_dsttime member.
*/
NTSTATUS
WINAPI
RtlSetTimeZoneInformation
(
const
TIME_ZONE_INFORMATION
*
tzinfo
)
...
...
@@ -753,14 +764,15 @@ NTSTATUS WINAPI RtlSetTimeZoneInformation( const TIME_ZONE_INFORMATION *tzinfo )
* NtSetSystemTime [NTDLL.@]
* ZwSetSystemTime [NTDLL.@]
*
* Set
s
the system time.
* Set the system time.
*
* PARAM
:
* NewTime [I] The time to set
the system time to
.
* OldTime [O] Optional
(ie. can be NULL). Old T
ime.
* PARAM
S
* NewTime [I] The time to set.
* OldTime [O] Optional
destination for the previous system t
ime.
*
* RETURNS
* Status.
* Success: STATUS_SUCCESS.
* Failure: An NTSTATUS error code indicating the problem.
*/
NTSTATUS
WINAPI
NtSetSystemTime
(
const
LARGE_INTEGER
*
NewTime
,
LARGE_INTEGER
*
OldTime
)
{
...
...
include/winternl.h
View file @
08922859
...
...
@@ -1215,7 +1215,7 @@ NTSTATUS WINAPI RtlSystemTimeToLocalTime(const LARGE_INTEGER*,PLARGE_INTEGER);
void
WINAPI
RtlTimeToTimeFields
(
const
LARGE_INTEGER
*
,
PTIME_FIELDS
);
BOOLEAN
WINAPI
RtlTimeFieldsToTime
(
PTIME_FIELDS
,
PLARGE_INTEGER
);
void
WINAPI
RtlTimeToElapsedTimeFields
(
const
LARGE_INTEGER
*
,
PTIME_FIELDS
);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
const
LARGE_INTEGER
*
,
PULONG
);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
const
LARGE_INTEGER
*
,
LPDWORD
);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
const
LARGE_INTEGER
*
,
LPDWORD
);
BOOL
WINAPI
RtlTryEnterCriticalSection
(
RTL_CRITICAL_SECTION
*
);
...
...
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