Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
b8d15446
Commit
b8d15446
authored
Oct 30, 2005
by
Robert Reif
Committed by
Alexandre Julliard
Oct 30, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement _wstrdate and _wstrtime with tests.
parent
78ea87c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
5 deletions
+82
-5
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+2
-2
time.c
dlls/msvcrt/tests/time.c
+53
-0
time.c
dlls/msvcrt/time.c
+27
-3
No files found.
dlls/msvcrt/msvcrt.spec
View file @
b8d15446
...
...
@@ -554,8 +554,8 @@
@ cdecl _wsplitpath(wstr wstr wstr wstr wstr)
@ cdecl _wstat(wstr ptr) MSVCRT__wstat
@ cdecl _wstati64(wstr ptr) MSVCRT__wstati64
@
stub _wstrdate #(p
tr)
@
stub _wstrtime #(p
tr)
@
cdecl _wstrdate(ws
tr)
@
cdecl _wstrtime(ws
tr)
@ stub _wsystem #(wstr)
@ cdecl _wtempnam(wstr wstr)
@ stub _wtmpnam #(ptr)
...
...
dlls/msvcrt/tests/time.c
View file @
b8d15446
...
...
@@ -179,11 +179,64 @@ static void test_localtime(void)
lt
->
tm_min
,
lt
->
tm_sec
,
lt
->
tm_isdst
);
putenv
(
TZ_env
);
}
static
void
test_strdate
(
void
)
{
char
date
[
16
],
*
result
;
int
month
,
day
,
year
,
count
,
len
;
result
=
_strdate
(
date
);
ok
(
result
==
date
,
"Wrong return value
\n
"
);
len
=
strlen
(
date
);
ok
(
len
==
8
,
"Wrong length: returned %d, should be 8
\n
"
,
len
);
count
=
sscanf
(
date
,
"%02d/%02d/%02d"
,
&
month
,
&
day
,
&
year
);
ok
(
count
==
3
,
"Wrong format: count = %d, should be 3
\n
"
,
count
);
}
static
void
test_strtime
(
void
)
{
char
time
[
16
],
*
result
;
int
hour
,
minute
,
second
,
count
,
len
;
result
=
_strtime
(
time
);
ok
(
result
==
time
,
"Wrong return value
\n
"
);
len
=
strlen
(
time
);
ok
(
len
==
8
,
"Wrong length: returned %d, should be 8
\n
"
,
len
);
count
=
sscanf
(
time
,
"%02d:%02d:%02d"
,
&
hour
,
&
minute
,
&
second
);
ok
(
count
==
3
,
"Wrong format: count = %d, should be 3
\n
"
,
count
);
}
static
void
test_wstrdate
(
void
)
{
wchar_t
date
[
16
],
*
result
;
int
month
,
day
,
year
,
count
,
len
;
wchar_t
format
[]
=
{
'%'
,
'0'
,
'2'
,
'd'
,
'/'
,
'%'
,
'0'
,
'2'
,
'd'
,
'/'
,
'%'
,
'0'
,
'2'
,
'd'
,
0
};
result
=
_wstrdate
(
date
);
ok
(
result
==
date
,
"Wrong return value
\n
"
);
len
=
wcslen
(
date
);
ok
(
len
==
8
,
"Wrong length: returned %d, should be 8
\n
"
,
len
);
count
=
swscanf
(
date
,
format
,
&
month
,
&
day
,
&
year
);
ok
(
count
==
3
,
"Wrong format: count = %d, should be 3
\n
"
,
count
);
}
static
void
test_wstrtime
(
void
)
{
wchar_t
time
[
16
],
*
result
;
int
hour
,
minute
,
second
,
count
,
len
;
wchar_t
format
[]
=
{
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
':'
,
'%'
,
'0'
,
'2'
,
'd'
,
0
};
result
=
_wstrtime
(
time
);
ok
(
result
==
time
,
"Wrong return value
\n
"
);
len
=
wcslen
(
time
);
ok
(
len
==
8
,
"Wrong length: returned %d, should be 8
\n
"
,
len
);
count
=
swscanf
(
time
,
format
,
&
hour
,
&
minute
,
&
second
);
ok
(
count
==
3
,
"Wrong format: count = %d, should be 3
\n
"
,
count
);
}
START_TEST
(
time
)
{
test_gmtime
();
test_mktime
();
test_localtime
();
test_strdate
();
test_strtime
();
test_wstrdate
();
test_wstrtime
();
}
dlls/msvcrt/time.c
View file @
b8d15446
...
...
@@ -221,16 +221,40 @@ char* _strdate(char* date)
return
date
;
}
/**********************************************************************
* _wstrdate (MSVCRT.@)
*/
MSVCRT_wchar_t
*
_wstrdate
(
MSVCRT_wchar_t
*
date
)
{
static
const
WCHAR
format
[]
=
{
'M'
,
'M'
,
'\''
,
'/'
,
'\''
,
'd'
,
'd'
,
'\''
,
'/'
,
'\''
,
'y'
,
'y'
,
0
};
GetDateFormatW
(
LOCALE_NEUTRAL
,
0
,
NULL
,
format
,
(
LPWSTR
)
date
,
9
);
return
date
;
}
/*********************************************************************
* _strtime (MSVCRT.@)
*/
char
*
_strtime
(
char
*
dat
e
)
char
*
_strtime
(
char
*
tim
e
)
{
LPCSTR
format
=
"HH':'mm':'ss"
;
GetTimeFormatA
(
LOCALE_NEUTRAL
,
0
,
NULL
,
format
,
dat
e
,
9
);
GetTimeFormatA
(
LOCALE_NEUTRAL
,
0
,
NULL
,
format
,
tim
e
,
9
);
return
date
;
return
time
;
}
/*********************************************************************
* _wstrtime (MSVCRT.@)
*/
MSVCRT_wchar_t
*
_wstrtime
(
MSVCRT_wchar_t
*
time
)
{
static
const
WCHAR
format
[]
=
{
'H'
,
'H'
,
'\''
,
':'
,
'\''
,
'm'
,
'm'
,
'\''
,
':'
,
'\''
,
's'
,
's'
,
0
};
GetTimeFormatW
(
LOCALE_NEUTRAL
,
0
,
NULL
,
format
,
(
LPWSTR
)
time
,
9
);
return
time
;
}
/*********************************************************************
...
...
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