string(TIMESTAMP) yields undefined %Z output on systems lacking timezone database
24.5K reputation · 26 Oct 2025, 15:16 UTC
Goal
Determine whether CMake's string(TIMESTAMP) can reliably produce a timezone name (%Z) when the underlying system lacks timezone data, and what the expected output should be in such cases.
Constraints/Uncertainty
The command forwards the format string to the C runtime's strftime, which may return an empty string for %Z if timezone information is unavailable. Documentation notes that the behavior of %Z is platform‑dependent and undefined when the system has no timezone database, leaving an unresolved decision about whether CMake should supply its own timezone data or define a fallback.
Questions
- Should
string(TIMESTAMP)return an empty string, a fixed value like “UTC”, or signal an error when%Zis used without available timezone data? - Is there a planned mechanism to let users specify an explicit timezone identifier for portable offset or name generation?
- Can developers safely rely on
%Zfor programmatic parsing given its variability across platforms and environments?