mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
string: Teach TIMESTAMP to treat %% as %
This encoding is documented by `strptime`.
This commit is contained in:
committed by
Brad King
parent
325c615308
commit
6c54f7b365
@@ -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).
|
||||
|
||||
5
Help/release/dev/timestamp-percent.rst
Normal file
5
Help/release/dev/timestamp-percent.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
timestamp-percent
|
||||
-----------------
|
||||
|
||||
* The :command:`string(TIMESTAMP)` command learned to treat ``%%``
|
||||
as a way to encode plain ``%``.
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -1 +1 @@
|
||||
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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
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}")
|
||||
|
||||
Reference in New Issue
Block a user