I have viewed this, and this, on SO, but they deal with non-C variations of the same problem.
Using GNU GCC compiler (Code::Blocks, in Windows) with the following code:
int main(void)
{
time_t rawtime;
struct tm *info;
char timeStr[80];
time( &rawtime );
info = localtime( &rawtime );
strftime(timeStr,80,"%a %b %d %H:%M:%S %Z %Y", info);
printf("%s", timeStr);
getchar();
return 0;
}
I am getting this time string:
Tue Aug 30 14:55:08 Pacific Daylight Time 2016
Everything is fine except time zone. I prefer it to be abbreviated, such as:
Tue Aug 30 14:55:08 PDT 2016
In every man page, or windows documentation for strftime() I can find the description for the format specifier %Z goes something like: Timezone name or abbreviation. ( eg. here. )
What is the trick to formatting timezone to be abbreviated?