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
bb2724ea
Commit
bb2724ea
authored
Mar 22, 2004
by
Uwe Bonnes
Committed by
Alexandre Julliard
Mar 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for time functions.
parent
7b597d4c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
0 deletions
+125
-0
.cvsignore
dlls/kernel/tests/.cvsignore
+1
-0
Makefile.in
dlls/kernel/tests/Makefile.in
+1
-0
time.c
dlls/kernel/tests/time.c
+123
-0
No files found.
dlls/kernel/tests/.cvsignore
View file @
bb2724ea
...
@@ -20,4 +20,5 @@ process.ok
...
@@ -20,4 +20,5 @@ process.ok
profile.ok
profile.ok
testlist.c
testlist.c
thread.ok
thread.ok
time.ok
virtual.ok
virtual.ok
dlls/kernel/tests/Makefile.in
View file @
bb2724ea
...
@@ -26,6 +26,7 @@ CTESTS = \
...
@@ -26,6 +26,7 @@ CTESTS = \
process.c
\
process.c
\
profile.c
\
profile.c
\
thread.c
\
thread.c
\
time.c
\
virtual.c
virtual.c
@MAKE_TEST_RULES@
@MAKE_TEST_RULES@
...
...
dlls/kernel/tests/time.c
0 → 100644
View file @
bb2724ea
/*
* Unit test suite for time functions
*
* Copyright 2004 Uwe Bonnes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/test.h"
#include "winbase.h"
#define SECSPERMIN 60
#define SECSPERDAY 86400
/* 1601 to 1970 is 369 years plus 89 leap days */
#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)
#define TICKSPERSEC 10000000
#define TICKSPERMSEC 10000
#define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
void
test_GetTimeZoneInformation
()
{
TIME_ZONE_INFORMATION
tzinfo
,
tzinfo1
;
DWORD
res
=
GetTimeZoneInformation
(
&
tzinfo
);
ok
(
res
!=
0
,
"GetTimeZoneInformation failed
\n
"
);
ok
(
SetEnvironmentVariableA
(
"TZ"
,
"GMT0"
)
!=
0
,
"SetEnvironmentVariableA failed
\n
"
);
res
=
GetTimeZoneInformation
(
&
tzinfo1
);
ok
(
res
!=
0
,
"GetTimeZoneInformation failed
\n
"
);
ok
(((
tzinfo
.
Bias
==
tzinfo1
.
Bias
)
&&
(
tzinfo
.
StandardBias
==
tzinfo1
.
StandardBias
)
&&
(
tzinfo
.
DaylightBias
==
tzinfo1
.
DaylightBias
)),
"Bias influenced by TZ variable
\n
"
);
ok
(
SetEnvironmentVariableA
(
"TZ"
,
NULL
)
!=
0
,
"SetEnvironmentVariableA failed
\n
"
);
}
void
test_FileTimeToSystemTime
()
{
FILETIME
ft
;
SYSTEMTIME
st
;
ULONGLONG
time
=
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1970
;
ft
.
dwHighDateTime
=
0
;
ft
.
dwLowDateTime
=
0
;
ok
(
FileTimeToSystemTime
(
&
ft
,
&
st
),
"FileTimeToSystemTime() failed with Error 0x%08lx
\n
"
,
GetLastError
());
ok
(((
st
.
wYear
==
1601
)
&&
(
st
.
wMonth
==
1
)
&&
(
st
.
wDay
==
1
)
&&
(
st
.
wHour
==
0
)
&&
(
st
.
wMinute
==
0
)
&&
(
st
.
wSecond
==
0
)
&&
(
st
.
wMilliseconds
==
0
)),
"Got Year %4d Month %2d Day %2d
\n
"
,
st
.
wYear
,
st
.
wMonth
,
st
.
wDay
);
ft
.
dwHighDateTime
=
(
UINT
)(
time
>>
32
);
ft
.
dwLowDateTime
=
(
UINT
)
time
;
ok
(
FileTimeToSystemTime
(
&
ft
,
&
st
),
"FileTimeToSystemTime() failed with Error 0x%08lx
\n
"
,
GetLastError
());
ok
(((
st
.
wYear
==
1970
)
&&
(
st
.
wMonth
==
1
)
&&
(
st
.
wDay
==
1
)
&&
(
st
.
wHour
==
0
)
&&
(
st
.
wMinute
==
0
)
&&
(
st
.
wSecond
==
1
)
&&
(
st
.
wMilliseconds
==
0
)),
"Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d
\n
"
,
st
.
wYear
,
st
.
wMonth
,
st
.
wDay
,
st
.
wHour
,
st
.
wMinute
,
st
.
wSecond
,
st
.
wMilliseconds
);
}
void
test_FileTimeToLocalFileTime
()
{
FILETIME
ft
,
lft
;
SYSTEMTIME
st
;
TIME_ZONE_INFORMATION
tzinfo
;
DWORD
res
=
GetTimeZoneInformation
(
&
tzinfo
);
ULONGLONG
time
=
(
ULONGLONG
)
TICKSPERSEC
+
TICKS_1601_TO_1970
+
(
ULONGLONG
)
tzinfo
.
Bias
*
SECSPERMIN
*
TICKSPERSEC
;
ok
(
res
!=
0
,
"GetTimeZoneInformation failed
\n
"
);
ft
.
dwHighDateTime
=
(
UINT
)(
time
>>
32
);
ft
.
dwLowDateTime
=
(
UINT
)
time
;
ok
(
FileTimeToLocalFileTime
(
&
ft
,
&
lft
)
!=
0
,
"FileTimeToLocalFileTime() failed with Error 0x%08lx
\n
"
,
GetLastError
());
FileTimeToSystemTime
(
&
lft
,
&
st
);
ok
(((
st
.
wYear
==
1970
)
&&
(
st
.
wMonth
==
1
)
&&
(
st
.
wDay
==
1
)
&&
(
st
.
wHour
==
0
)
&&
(
st
.
wMinute
==
0
)
&&
(
st
.
wSecond
==
1
)
&&
(
st
.
wMilliseconds
==
0
)),
"Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d
\n
"
,
st
.
wYear
,
st
.
wMonth
,
st
.
wDay
,
st
.
wHour
,
st
.
wMinute
,
st
.
wSecond
,
st
.
wMilliseconds
);
ok
(
SetEnvironmentVariableA
(
"TZ"
,
"GMT"
)
!=
0
,
"SetEnvironmentVariableA failed
\n
"
);
ok
(
res
!=
0
,
"GetTimeZoneInformation failed
\n
"
);
ok
(
FileTimeToLocalFileTime
(
&
ft
,
&
lft
)
!=
0
,
"FileTimeToLocalFileTime() failed with Error 0x%08lx
\n
"
,
GetLastError
());
FileTimeToSystemTime
(
&
lft
,
&
st
);
ok
(((
st
.
wYear
==
1970
)
&&
(
st
.
wMonth
==
1
)
&&
(
st
.
wDay
==
1
)
&&
(
st
.
wHour
==
0
)
&&
(
st
.
wMinute
==
0
)
&&
(
st
.
wSecond
==
1
)
&&
(
st
.
wMilliseconds
==
0
)),
"Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d
\n
"
,
st
.
wYear
,
st
.
wMonth
,
st
.
wDay
,
st
.
wHour
,
st
.
wMinute
,
st
.
wSecond
,
st
.
wMilliseconds
);
ok
(
SetEnvironmentVariableA
(
"TZ"
,
NULL
)
!=
0
,
"SetEnvironmentVariableA failed
\n
"
);
}
START_TEST
(
time
)
{
test_GetTimeZoneInformation
();
test_FileTimeToSystemTime
();
test_FileTimeToLocalFileTime
();
}
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