CMake get current time
CMake can retrieve the current time in local (default), UTC, or other timezone via
string(TIMESTAMP).
Elapsed time can also readily be computed or compared using timestamp format %s
Currently, CMake math command cannot handle floating point numbers, only integers.
string(TIMESTAMP t)
message(STATUS "local time: ${t}")
string(TIMESTAMP t0 "%s")
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.0)
string(TIMESTAMP t1 "%s")
math(EXPR elapsed "${t1} - ${t0}")
message(STATUS "Elapsed time: ${elapsed} seconds")