while (utc_service_status.dwCurrentState == SERVICE_RUNNING){
time(&secs);
tptr1 = localtime( &secs );
local_secs = mktime( tptr1 );
tptr2 = gmtime( &secs );
tptr2->tm_isdst = -1;
gmt_secs = mktime( tptr2 );
diff_secs = (local_secs - gmt_secs);
*utc_bias = diff_secs/60;
}
This is the sample code.when this service is running am changing the timezone.
Technically, this depends on your implementation of localtime and how it chooses to do time zone conversion.
The manual page for localtime(3) on Linux says:
It also adds this note, under "BUGS":
So this seems to suggest "probably not." You might find it useful to test yourself, with a program that calls localtime, then changes the
TZ
environment variable (and/or the/etc/timezone
symlink) and calls localtime again.