Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
dcc3afd2
Commit
dcc3afd2
authored
22 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Avoid casts between LARGE_INTEGER and FILETIME.
Fixed day of week of epoch. Small cleanups.
parent
309fde7a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/kernel/time.c
+54
-26
54 additions, 26 deletions
dlls/kernel/time.c
dlls/ntdll/time.c
+4
-11
4 additions, 11 deletions
dlls/ntdll/time.c
include/winbase.h
+1
-1
1 addition, 1 deletion
include/winbase.h
with
59 additions
and
38 deletions
dlls/kernel/time.c
+
54
−
26
View file @
dcc3afd2
...
...
@@ -60,14 +60,15 @@ BOOL WINAPI SetLocalTime(
const
SYSTEMTIME
*
systime
)
/* [in] The desired local time. */
{
FILETIME
ft
;
LARGE_INTEGER
st
;
LARGE_INTEGER
st
,
st2
;
NTSTATUS
status
;
SystemTimeToFileTime
(
systime
,
&
ft
);
st
.
s
.
LowPart
=
ft
.
dwLowDateTime
;
st
.
s
.
HighPart
=
ft
.
dwHighDateTime
;
RtlLocalTimeToSystemTime
(
&
st
,
&
st2
);
RtlLocalTimeToSystemTime
(
(
PLARGE_INTEGER
)
&
ft
,
&
st
);
if
((
status
=
NtSetSystemTime
(
&
st
,
NULL
)))
if
((
status
=
NtSetSystemTime
(
&
st2
,
NULL
)))
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
!
status
;
}
...
...
@@ -112,11 +113,13 @@ BOOL WINAPI GetSystemTimeAdjustment(
BOOL
WINAPI
SetSystemTime
(
const
SYSTEMTIME
*
systime
)
/* [in] The desired system time. */
{
FILETIME
ft
;
LARGE_INTEGER
t
;
NTSTATUS
status
;
SystemTimeToFileTime
(
systime
,
(
PFILETIME
)
&
t
);
SystemTimeToFileTime
(
systime
,
&
ft
);
t
.
s
.
LowPart
=
ft
.
dwLowDateTime
;
t
.
s
.
HighPart
=
ft
.
dwHighDateTime
;
if
((
status
=
NtSetSystemTime
(
&
t
,
NULL
)))
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
!
status
;
...
...
@@ -194,7 +197,10 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime(
VOID
WINAPI
GetSystemTimeAsFileTime
(
LPFILETIME
time
)
/* [out] The file time struct to be filled with the system time. */
{
NtQuerySystemTime
(
(
LARGE_INTEGER
*
)
time
);
LARGE_INTEGER
t
;
NtQuerySystemTime
(
&
t
);
time
->
dwLowDateTime
=
t
.
s
.
LowPart
;
time
->
dwHighDateTime
=
t
.
s
.
HighPart
;
}
...
...
@@ -435,26 +441,40 @@ int WINAPI SetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPCWST
/*********************************************************************
* LocalFileTimeToFileTime (KERNEL32.@)
*/
BOOL
WINAPI
LocalFileTimeToFileTime
(
const
FILETIME
*
localft
,
LPFILETIME
utcft
)
BOOL
WINAPI
LocalFileTimeToFileTime
(
const
FILETIME
*
localft
,
LPFILETIME
utcft
)
{
NTSTATUS
status
;
if
((
status
=
RtlLocalTimeToSystemTime
((
PLARGE_INTEGER
)
localft
,
(
PLARGE_INTEGER
)
utcft
)))
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
LARGE_INTEGER
local
,
utc
;
local
.
s
.
LowPart
=
localft
->
dwLowDateTime
;
local
.
s
.
HighPart
=
localft
->
dwHighDateTime
;
if
(
!
(
status
=
RtlLocalTimeToSystemTime
(
&
local
,
&
utc
)))
{
utcft
->
dwLowDateTime
=
utc
.
s
.
LowPart
;
utcft
->
dwHighDateTime
=
utc
.
s
.
HighPart
;
}
else
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
!
status
;
}
/*********************************************************************
* FileTimeToLocalFileTime (KERNEL32.@)
*/
BOOL
WINAPI
FileTimeToLocalFileTime
(
const
FILETIME
*
utcft
,
LPFILETIME
localft
)
BOOL
WINAPI
FileTimeToLocalFileTime
(
const
FILETIME
*
utcft
,
LPFILETIME
localft
)
{
NTSTATUS
status
;
if
((
status
=
RtlSystemTimeToLocalTime
((
PLARGE_INTEGER
)
utcft
,
(
PLARGE_INTEGER
)
localft
)))
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
LARGE_INTEGER
local
,
utc
;
utc
.
s
.
LowPart
=
utcft
->
dwLowDateTime
;
utc
.
s
.
HighPart
=
utcft
->
dwHighDateTime
;
if
(
!
(
status
=
RtlSystemTimeToLocalTime
(
&
utc
,
&
local
)))
{
localft
->
dwLowDateTime
=
local
.
s
.
LowPart
;
localft
->
dwHighDateTime
=
local
.
s
.
HighPart
;
}
else
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
!
status
;
}
...
...
@@ -464,8 +484,11 @@ BOOL WINAPI FileTimeToLocalFileTime( const FILETIME *utcft,
BOOL
WINAPI
FileTimeToSystemTime
(
const
FILETIME
*
ft
,
LPSYSTEMTIME
syst
)
{
TIME_FIELDS
tf
;
LARGE_INTEGER
t
;
RtlTimeToTimeFields
((
PLARGE_INTEGER
)
ft
,
&
tf
);
t
.
s
.
LowPart
=
ft
->
dwLowDateTime
;
t
.
s
.
HighPart
=
ft
->
dwHighDateTime
;
RtlTimeToTimeFields
(
&
t
,
&
tf
);
syst
->
wYear
=
tf
.
Year
;
syst
->
wMonth
=
tf
.
Month
;
...
...
@@ -484,6 +507,7 @@ BOOL WINAPI FileTimeToSystemTime( const FILETIME *ft, LPSYSTEMTIME syst )
BOOL
WINAPI
SystemTimeToFileTime
(
const
SYSTEMTIME
*
syst
,
LPFILETIME
ft
)
{
TIME_FIELDS
tf
;
LARGE_INTEGER
t
;
tf
.
Year
=
syst
->
wYear
;
tf
.
Month
=
syst
->
wMonth
;
...
...
@@ -493,14 +517,16 @@ BOOL WINAPI SystemTimeToFileTime( const SYSTEMTIME *syst, LPFILETIME ft )
tf
.
Second
=
syst
->
wSecond
;
tf
.
Milliseconds
=
syst
->
wMilliseconds
;
RtlTimeFieldsToTime
(
&
tf
,
(
PLARGE_INTEGER
)
ft
);
RtlTimeFieldsToTime
(
&
tf
,
&
t
);
ft
->
dwLowDateTime
=
t
.
s
.
LowPart
;
ft
->
dwHighDateTime
=
t
.
s
.
HighPart
;
return
TRUE
;
}
/*********************************************************************
* CompareFileTime (KERNEL32.@)
*/
INT
WINAPI
CompareFileTime
(
LP
FILETIME
x
,
LP
FILETIME
y
)
INT
WINAPI
CompareFileTime
(
const
FILETIME
*
x
,
const
FILETIME
*
y
)
{
if
(
!
x
||
!
y
)
return
-
1
;
...
...
@@ -521,12 +547,12 @@ INT WINAPI CompareFileTime( LPFILETIME x, LPFILETIME y )
VOID
WINAPI
GetLocalTime
(
LPSYSTEMTIME
systime
)
{
FILETIME
lft
;
LARGE_INTEGER
ft
;
LARGE_INTEGER
ft
,
ft2
;
NtQuerySystemTime
(
&
ft
);
RtlSystemTimeToLocalTime
(
&
ft
,
(
PLARGE_INTEGER
)
&
lft
)
;
RtlSystemTimeToLocalTime
(
&
ft
,
&
ft2
);
lft
.
dwLowDateTime
=
ft2
.
s
.
LowPart
;
lft
.
dwHighDateTime
=
ft2
.
s
.
HighPart
;
FileTimeToSystemTime
(
&
lft
,
systime
);
}
...
...
@@ -536,8 +562,10 @@ VOID WINAPI GetLocalTime(LPSYSTEMTIME systime)
VOID
WINAPI
GetSystemTime
(
LPSYSTEMTIME
systime
)
{
FILETIME
ft
;
LARGE_INTEGER
t
;
NtQuerySystemTime
((
PLARGE_INTEGER
)
&
ft
);
NtQuerySystemTime
(
&
t
);
ft
.
dwLowDateTime
=
t
.
s
.
LowPart
;
ft
.
dwHighDateTime
=
t
.
s
.
HighPart
;
FileTimeToSystemTime
(
&
ft
,
systime
);
}
This diff is collapsed.
Click to expand it.
dlls/ntdll/time.c
+
4
−
11
View file @
dcc3afd2
...
...
@@ -258,7 +258,7 @@ static const struct tagTZ_INFO TZ_INFO[] =
#define SECSPERMIN 60
#define MINSPERHOUR 60
#define HOURSPERDAY 24
#define EPOCHWEEKDAY
0
#define EPOCHWEEKDAY
1
/* Jan 1, 1601 was Monday */
#define DAYSPERWEEK 7
#define EPOCHYEAR 1601
#define DAYSPERNORMALYEAR 365
...
...
@@ -309,11 +309,7 @@ VOID WINAPI RtlTimeToTimeFields(
int
SecondsInDay
,
CurYear
;
int
LeapYear
,
CurMonth
;
long
int
Days
;
LONGLONG
Time
;
Time
=
liTime
->
s
.
HighPart
;
Time
<<=
32
;
Time
+=
liTime
->
s
.
LowPart
;
LONGLONG
Time
=
liTime
->
QuadPart
;
/* Extract millisecond from time and convert time into seconds */
TimeFields
->
Milliseconds
=
(
CSHORT
)
((
Time
%
TICKSPERSEC
)
/
TICKSPERMSEC
);
...
...
@@ -408,7 +404,7 @@ BOOLEAN WINAPI RtlTimeFieldsToTime(
rcTime
+=
TimeFields
.
Hour
*
SECSPERHOUR
+
TimeFields
.
Minute
*
SECSPERMIN
+
TimeFields
.
Second
;
rcTime
*=
TICKSPERSEC
;
rcTime
+=
TimeFields
.
Milliseconds
*
TICKSPERMSEC
;
*
Time
=
*
(
LARGE_INTEGER
*
)
&
rcTime
;
Time
->
QuadPart
=
rcTime
;
return
TRUE
;
}
...
...
@@ -582,13 +578,10 @@ VOID WINAPI RtlTimeToElapsedTimeFields(
*/
NTSTATUS
WINAPI
NtQuerySystemTime
(
PLARGE_INTEGER
time
)
{
ULONGLONG
secs
;
struct
timeval
now
;
gettimeofday
(
&
now
,
0
);
secs
=
RtlExtendedIntegerMultiply
(
now
.
tv_sec
+
SECS_1601_TO_1970
,
10000000
)
+
now
.
tv_usec
*
10
;
time
->
s
.
LowPart
=
(
DWORD
)
secs
;
time
->
s
.
HighPart
=
(
DWORD
)(
secs
>>
32
);
time
->
QuadPart
=
RtlExtendedIntegerMultiply
(
now
.
tv_sec
+
SECS_1601_TO_1970
,
10000000
)
+
now
.
tv_usec
*
10
;
return
STATUS_SUCCESS
;
}
...
...
This diff is collapsed.
Click to expand it.
include/winbase.h
+
1
−
1
View file @
dcc3afd2
...
...
@@ -1177,7 +1177,7 @@ BOOL WINAPI CopyFileExA(LPCSTR, LPCSTR, LPPROGRESS_ROUTINE, LPVOID, LPBOO
BOOL
WINAPI
CopyFileExW
(
LPCWSTR
,
LPCWSTR
,
LPPROGRESS_ROUTINE
,
LPVOID
,
LPBOOL
,
DWORD
);
#define CopyFileEx WINELIB_NAME_AW(CopyFileEx)
BOOL
WINAPI
CopySid
(
DWORD
,
PSID
,
PSID
);
INT
WINAPI
CompareFileTime
(
LP
FILETIME
,
LP
FILETIME
);
INT
WINAPI
CompareFileTime
(
const
FILETIME
*
,
const
FILETIME
*
);
HANDLE
WINAPI
CreateEventA
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
BOOL
,
LPCSTR
);
HANDLE
WINAPI
CreateEventW
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
BOOL
,
LPCWSTR
);
#define CreateEvent WINELIB_NAME_AW(CreateEvent)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment