Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bernhard M. Wiedemann
CMake
Commits
6c54f7b3
Commit
6c54f7b3
authored
Jan 27, 2017
by
Bernhard M. Wiedemann
Committed by
Brad King
Jan 27, 2017
Browse files
string: Teach TIMESTAMP to treat %% as %
This encoding is documented by `strptime`.
parent
325c6153
Pipeline
#44513
passed with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Help/command/string.rst
View file @
6c54f7b3
...
...
@@ -296,6 +296,7 @@ specifiers:
::
%% A literal percent sign (%).
%d The day of the current month (01-31).
%H The hour on a 24-hour clock (00-23).
%I The hour on a 12-hour clock (01-12).
...
...
Help/release/dev/timestamp-percent.rst
0 → 100644
View file @
6c54f7b3
timestamp-percent
-----------------
* The :command:`string(TIMESTAMP)` command learned to treat ``%%``
as a way to encode plain ``%``.
Source/cmTimestamp.cxx
View file @
6c54f7b3
...
...
@@ -136,6 +136,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag,
case
'w'
:
case
'y'
:
case
'Y'
:
case
'%'
:
break
;
case
's'
:
// Seconds since UNIX epoch (midnight 1-jan-1970)
{
...
...
Tests/RunCMake/string/Timestamp-stderr.txt
View file @
6c54f7b3
RESULT=2005-08-07 23:19:49 Sun Aug 05 day=219 wd=0 week=32
%
%I=11
RESULT=2005-08-07 23:19:49 Sun Aug 05 day=219 wd=0 week=32 %I=11
epoch=1123456789
Tests/RunCMake/string/Timestamp.cmake
View file @
6c54f7b3
set
(
ENV{SOURCE_DATE_EPOCH}
"1123456789"
)
string
(
TIMESTAMP RESULT
"%Y-%m-%d %H:%M:%S %a %b %y day=%j wd=%w week=%U %%I=%I"
UTC
)
string
(
TIMESTAMP RESULT
"%Y-%m-%d %H:%M:%S %a %b %y day=%j wd=%w week=%U %%I=%I
epoch=%s
"
UTC
)
message
(
"RESULT=
${
RESULT
}
"
)
Write
Preview
Supports
Markdown
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