View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004071CMakeCMakepublic2006-11-23 11:322014-06-02 08:37
ReporterTanguy Krotoff 
Assigned ToNils Gladitz 
PrioritylowSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in VersionCMake 2.8.11 
Summary0004071: Add a time() function to CMake
DescriptionSometimes it can be useful to get the build date/time of a program/lib

I like this
2006-11-23 17:24:00
because it can be very easily be converted to an integer. An integer is interesting because then you can compare build date/time and then have an update system
TagsNo tags attached.
Attached Fileszip file icon cmTimeCommand.zip [^] (2,003 bytes) 2013-04-15 10:26

 Relationships

  Notes
(0032838)
Mark Stijnman (reporter)
2013-04-15 10:45

I would like this too, for generating header files with build date strings, version numbers based on release dates, etc, so I figured I'd just implement it. The result is in cmTimeCommand.zip, which I've just uploaded.

This 'time' command takes a variable name, and optionally a format specifier (as defined in http://www.cplusplus.com/reference/ctime/strftime/ [^]). The default is "%Y-%m-%d %H:%M:%S", which happens to be the format the OP requested. Examples:

time(my_iso_date) // 2013-04-15 16:36:05
time(version_number "%Y.%m") // 2013.04
time(build_date "%B %d, %Y") // April 15, 2013
time(my_time "%H:%M") // 16:35

Note that I have tested this by hand, but I'm not sure how you would add a test for this feature to the regression test set, as it will produce different output every time.
(0033234)
Mark Stijnman (reporter)
2013-06-04 10:16

It seems this ticket can be closed with the new STRING(TIMESTAMP ...) feature in 2.8.11.
(0034314)
Stephen Kelly (developer)
2013-11-02 09:09

Done in 711e2b3b5c674d4f754b5b214d511be6ce7e8f4d
(0035997)
Robert Maynard (manager)
2014-06-02 08:37

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-04-15 10:26 Mark Stijnman File Added: cmTimeCommand.zip
2013-04-15 10:45 Mark Stijnman Note Added: 0032838
2013-06-04 10:16 Mark Stijnman Note Added: 0033234
2013-11-02 09:09 Stephen Kelly Note Added: 0034314
2013-11-02 09:09 Stephen Kelly Status assigned => resolved
2013-11-02 09:09 Stephen Kelly Fixed in Version => CMake 2.8.11
2013-11-02 09:09 Stephen Kelly Resolution open => fixed
2013-11-02 09:09 Stephen Kelly Assigned To Bill Hoffman => Nils Gladitz
2014-06-02 08:37 Robert Maynard Note Added: 0035997
2014-06-02 08:37 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team