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
f65c4267
Commit
f65c4267
authored
Oct 28, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ucrtbase: Implement %G format for strftime.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c18ebdfe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
time.c
dlls/msvcrt/time.c
+9
-0
misc.c
dlls/ucrtbase/tests/misc.c
+24
-0
No files found.
dlls/msvcrt/time.c
View file @
f65c4267
...
...
@@ -1196,6 +1196,15 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
if
(
!
strftime_int
(
str
,
&
ret
,
max
,
mstm
->
tm_mday
,
alternate
?
0
:
2
,
0
,
31
))
return
0
;
break
;
case
'G'
:
tmp
=
1900
+
mstm
->
tm_year
;
if
(
mstm
->
tm_yday
-
(
mstm
->
tm_wday
?
mstm
->
tm_wday
:
7
)
+
4
<
0
)
tmp
--
;
else
if
(
mstm
->
tm_yday
-
(
mstm
->
tm_wday
?
mstm
->
tm_wday
:
7
)
+
5
>
365
+
IsLeapYear
(
tmp
))
tmp
++
;
if
(
!
strftime_int
(
str
,
&
ret
,
max
,
tmp
,
4
,
0
,
9999
))
return
0
;
break
;
#endif
case
'H'
:
if
(
!
strftime_int
(
str
,
&
ret
,
max
,
mstm
->
tm_hour
,
alternate
?
0
:
2
,
0
,
23
))
...
...
dlls/ucrtbase/tests/misc.c
View file @
f65c4267
...
...
@@ -138,6 +138,7 @@ static void (CDECL *p___setusermatherr)(MSVCRT_matherr_func);
static
int
*
(
CDECL
*
p_errno
)(
void
);
static
char
*
(
CDECL
*
p_asctime
)(
const
struct
tm
*
);
static
size_t
(
__cdecl
*
p_strftime
)(
char
*
,
size_t
,
const
char
*
,
const
struct
tm
*
);
static
struct
tm
*
(
__cdecl
*
p__gmtime32
)(
const
__time32_t
*
);
static
void
(
CDECL
*
p_exit
)(
int
);
static
int
(
CDECL
*
p__crt_atexit
)(
void
(
CDECL
*
)(
void
));
static
int
(
__cdecl
*
p_crt_at_quick_exit
)(
void
(
__cdecl
*
func
)(
void
));
...
...
@@ -509,6 +510,7 @@ static BOOL init(void)
p_errno
=
(
void
*
)
GetProcAddress
(
module
,
"_errno"
);
p_asctime
=
(
void
*
)
GetProcAddress
(
module
,
"asctime"
);
p_strftime
=
(
void
*
)
GetProcAddress
(
module
,
"strftime"
);
p__gmtime32
=
(
void
*
)
GetProcAddress
(
module
,
"_gmtime32"
);
p__crt_atexit
=
(
void
*
)
GetProcAddress
(
module
,
"_crt_atexit"
);
p_exit
=
(
void
*
)
GetProcAddress
(
module
,
"exit"
);
p_crt_at_quick_exit
=
(
void
*
)
GetProcAddress
(
module
,
"_crt_at_quick_exit"
);
...
...
@@ -904,6 +906,7 @@ static void test_strftime(void)
const
struct
tm
tm1
=
{
0
,
0
,
0
,
1
,
0
,
117
,
0
,
0
,
0
};
char
bufA
[
256
];
size_t
retA
;
int
i
;
retA
=
p_strftime
(
bufA
,
sizeof
(
bufA
),
"%C"
,
&
epoch
);
ok
(
retA
==
2
,
"expected 2, got %d
\n
"
,
(
int
)
retA
);
...
...
@@ -964,6 +967,27 @@ static void test_strftime(void)
retA
=
p_strftime
(
bufA
,
sizeof
(
bufA
),
"%t"
,
&
epoch
);
ok
(
retA
==
1
,
"expected 1, got %d
\n
"
,
(
int
)
retA
);
ok
(
!
strcmp
(
bufA
,
"
\t
"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
sizeof
(
bufA
),
"%G"
,
&
epoch
);
ok
(
retA
==
4
,
"expected 4, got %d
\n
"
,
(
int
)
retA
);
ok
(
!
strcmp
(
bufA
,
"1970"
),
"got %s
\n
"
,
bufA
);
retA
=
p_strftime
(
bufA
,
sizeof
(
bufA
),
"%G"
,
&
tm1
);
ok
(
retA
==
4
,
"expected 4, got %d
\n
"
,
(
int
)
retA
);
ok
(
!
strcmp
(
bufA
,
"2016"
),
"got %s
\n
"
,
bufA
);
for
(
i
=
0
;
i
<
14
;
i
++
)
{
__time32_t
t
=
(
365
*
2
+
i
-
7
)
*
24
*
60
*
60
;
struct
tm
tm
=
*
p__gmtime32
(
&
t
);
retA
=
p_strftime
(
bufA
,
sizeof
(
bufA
),
"%G"
,
&
tm
);
ok
(
retA
==
4
,
"%d) retA = %d
\n
"
,
i
,
(
int
)
retA
);
if
(
i
<=
8
)
ok
(
!
strcmp
(
bufA
,
"1971"
),
"%d) got %s, expected 1971
\n
"
,
i
,
bufA
);
else
ok
(
!
strcmp
(
bufA
,
"1972"
),
"%d) got %s, expected 1972
\n
"
,
i
,
bufA
);
}
}
static
LONG
*
get_failures_counter
(
HANDLE
*
map
)
...
...
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