string(TIMESTAMP ...): add '%a' and '%b' format specifiers
%b: Abbreviated month name (e.g. Oct). %a: Abbreviated weekday name (e.g. Fri).
This commit is contained in:
parent
d5e4cdc0f8
commit
751f7b5255
|
@ -278,12 +278,14 @@ specifiers:
|
||||||
%I The hour on a 12-hour clock (01-12).
|
%I The hour on a 12-hour clock (01-12).
|
||||||
%j The day of the current year (001-366).
|
%j The day of the current year (001-366).
|
||||||
%m The month of the current year (01-12).
|
%m The month of the current year (01-12).
|
||||||
|
%b Abbreviated month name (e.g. Oct).
|
||||||
%M The minute of the current hour (00-59).
|
%M The minute of the current hour (00-59).
|
||||||
%s Seconds since midnight (UTC) 1-Jan-1970 (UNIX time).
|
%s Seconds since midnight (UTC) 1-Jan-1970 (UNIX time).
|
||||||
%S The second of the current minute.
|
%S The second of the current minute.
|
||||||
60 represents a leap second. (00-60)
|
60 represents a leap second. (00-60)
|
||||||
%U The week number of the current year (00-53).
|
%U The week number of the current year (00-53).
|
||||||
%w The day of the current week. 0 is Sunday. (0-6)
|
%w The day of the current week. 0 is Sunday. (0-6)
|
||||||
|
%a Abbreviated weekday name (e.g. Fri).
|
||||||
%y The last two digits of the current year (00-99)
|
%y The last two digits of the current year (00-99)
|
||||||
%Y The current year.
|
%Y The current year.
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,8 @@ std::string cmTimestamp::AddTimestampComponent(char flag,
|
||||||
formatString += flag;
|
formatString += flag;
|
||||||
|
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
case 'a':
|
||||||
|
case 'b':
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'H':
|
case 'H':
|
||||||
case 'I':
|
case 'I':
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
string(TIMESTAMP output "%a;%b")
|
||||||
|
message("~${output}~")
|
||||||
|
|
||||||
|
list(LENGTH output output_length)
|
||||||
|
|
||||||
|
set(expected_output_length 2)
|
||||||
|
|
||||||
|
if(NOT output_length EQUAL ${expected_output_length})
|
||||||
|
message(FATAL_ERROR "expected ${expected_output_length} entries in output "
|
||||||
|
"with all specifiers; found ${output_length}")
|
||||||
|
endif()
|
|
@ -36,6 +36,8 @@ set(TIMESTAMP-IncompleteSpecifier-RESULT 0)
|
||||||
set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~")
|
set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~")
|
||||||
set(TIMESTAMP-AllSpecifiers-RESULT 0)
|
set(TIMESTAMP-AllSpecifiers-RESULT 0)
|
||||||
set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~")
|
set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~")
|
||||||
|
set(TIMESTAMP-MonthWeekNames-RESULT 0)
|
||||||
|
set(TIMESTAMP-MonthWeekNames-STDERR "~[^%]+;[^%]+~")
|
||||||
set(TIMESTAMP-UnixTime-RESULT 0)
|
set(TIMESTAMP-UnixTime-RESULT 0)
|
||||||
set(TIMESTAMP-UnixTime-STDERR "~[1-9][0-9]+~")
|
set(TIMESTAMP-UnixTime-STDERR "~[1-9][0-9]+~")
|
||||||
|
|
||||||
|
@ -60,6 +62,7 @@ check_cmake_test(String
|
||||||
TIMESTAMP-UnknownSpecifier
|
TIMESTAMP-UnknownSpecifier
|
||||||
TIMESTAMP-IncompleteSpecifier
|
TIMESTAMP-IncompleteSpecifier
|
||||||
TIMESTAMP-AllSpecifiers
|
TIMESTAMP-AllSpecifiers
|
||||||
|
TIMESTAMP-MonthWeekNames
|
||||||
TIMESTAMP-UnixTime
|
TIMESTAMP-UnixTime
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue