I have a C programme, which prints a timestamp as a string using the following line:
sprintf (scratch_buffer, "%s\0", dfr_time_date_strg);
This timestamp is always printed as UTC, but I would like to add the string of the calls date +%z
and date +%Z
.
The two timezone values can be called as such:
system("date +%z");
system("date +%Z");
But how can I assign these to char
strings called tz_offset
and tz_name
so that the final timestamp print line is:
sprintf (scratch_buffer, "%s %s (%s)\0", dfr_time_date_strg, tz_offset, tz_name);