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
9aef0770
Commit
9aef0770
authored
Apr 02, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A couple of optimizations and bug fixes.
parent
2d913578
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
time.c
dlls/ntdll/time.c
+14
-12
No files found.
dlls/ntdll/time.c
View file @
9aef0770
...
...
@@ -298,6 +298,12 @@ static const int MonthLengths[2][MONSPERYEAR] =
{
31
,
29
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
}
};
static
const
int
YearDays
[
2
][
MONSPERYEAR
+
1
]
=
{
{
0
,
31
,
59
,
90
,
120
,
151
,
181
,
212
,
243
,
273
,
304
,
334
,
365
},
{
0
,
31
,
60
,
91
,
121
,
152
,
182
,
213
,
244
,
274
,
305
,
335
,
366
}
};
static
inline
int
IsLeapYear
(
int
Year
)
{
return
Year
%
4
==
0
&&
(
Year
%
100
!=
0
||
Year
%
400
==
0
)
?
1
:
0
;
...
...
@@ -359,7 +365,6 @@ VOID WINAPI RtlTimeToTimeFields(
const
LARGE_INTEGER
*
liTime
,
PTIME_FIELDS
TimeFields
)
{
const
int
*
Months
;
int
SecondsInDay
,
DeltaYear
;
int
LeapYear
,
CurMonth
;
long
int
Days
;
...
...
@@ -404,11 +409,10 @@ VOID WINAPI RtlTimeToTimeFields(
LeapYear
=
IsLeapYear
(
TimeFields
->
Year
);
/* Compute month of year */
Months
=
MonthLengths
[
LeapYear
];
for
(
CurMonth
=
0
;
Days
>=
(
long
)
Months
[
CurMonth
];
CurMonth
++
)
Days
=
Days
-
(
long
)
Months
[
CurMonth
];
TimeFields
->
Month
=
(
CSHORT
)
(
CurMonth
+
1
);
TimeFields
->
Day
=
(
CSHORT
)
(
Days
+
1
);
CurMonth
=
1
;
while
(
Days
>=
YearDays
[
LeapYear
][
CurMonth
])
CurMonth
++
;
TimeFields
->
Day
=
Days
-
YearDays
[
LeapYear
][
CurMonth
-
1
]
+
1
;
TimeFields
->
Month
=
CurMonth
;
}
/******************************************************************************
...
...
@@ -428,7 +432,7 @@ BOOLEAN WINAPI RtlTimeFieldsToTime(
PTIME_FIELDS
tfTimeFields
,
PLARGE_INTEGER
Time
)
{
int
CurYear
,
CurMonth
,
DeltaYear
;
int
CurYear
,
DeltaYear
;
LONGLONG
rcTime
;
TIME_FIELDS
TimeFields
=
*
tfTimeFields
;
...
...
@@ -445,7 +449,8 @@ BOOLEAN WINAPI RtlTimeFieldsToTime(
{
NormalizeTimeFields
(
&
TimeFields
.
Hour
,
&
TimeFields
.
Day
,
HOURSPERDAY
);
}
while
(
TimeFields
.
Day
>
MonthLengths
[
IsLeapYear
(
TimeFields
.
Year
)][
TimeFields
.
Month
-
1
])
{
NormalizeTimeFields
(
&
TimeFields
.
Day
,
&
TimeFields
.
Month
,
SECSPERMIN
);
{
NormalizeTimeFields
(
&
TimeFields
.
Day
,
&
TimeFields
.
Month
,
MonthLengths
[
IsLeapYear
(
TimeFields
.
Year
)][
TimeFields
.
Month
-
1
]);
}
while
(
TimeFields
.
Month
>
MONSPERYEAR
)
{
NormalizeTimeFields
(
&
TimeFields
.
Month
,
&
TimeFields
.
Year
,
MONSPERYEAR
);
...
...
@@ -463,10 +468,7 @@ BOOLEAN WINAPI RtlTimeFieldsToTime(
CurYear
-=
DeltaYear
*
4
;
rcTime
+=
DeltaYear
*
DAYSPERNORMALQUADRENNIUM
;
rcTime
+=
CurYear
*
DAYSPERNORMALYEAR
;
for
(
CurMonth
=
1
;
CurMonth
<
TimeFields
.
Month
;
CurMonth
++
)
{
rcTime
+=
MonthLengths
[
IsLeapYear
(
TimeFields
.
Year
)][
CurMonth
-
1
];
}
rcTime
+=
YearDays
[
IsLeapYear
(
TimeFields
.
Year
)][
TimeFields
.
Month
-
1
];
rcTime
+=
TimeFields
.
Day
-
1
;
rcTime
*=
SECSPERDAY
;
rcTime
+=
TimeFields
.
Hour
*
SECSPERHOUR
+
TimeFields
.
Minute
*
SECSPERMIN
+
TimeFields
.
Second
;
...
...
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