M
Mike Conmackie
Greetings,
Is there any way to force strftime() to ignore locale settings when
formatting the resulting string? I have a requirement to create a specific
date-time string format in UTC. gmtime() will populate a struct tm with the
correct values but strftime() always assumes that the values are in local
time. I could manually adjust the struct tm values so that strftime() would
generate the desired string but it gets really ugly when the locale is west
of 0 degrees longitude. Furthermore, experimentation has shown that
strftime() can correctly adjust the values when they exceed the normal upper
range but not when they are negative (i.e. after an arbitrary subtraction
which would be required to adjust local time appropriately for locales west
of 0 degrees longitude). Would using putenv("TZ=UTC0DUT") with tzset()
solve the problem (assuming that I have no need of locally adjusted time)?
Any thoughts/help would be greatly appreciated. Thanks.
Mike
Is there any way to force strftime() to ignore locale settings when
formatting the resulting string? I have a requirement to create a specific
date-time string format in UTC. gmtime() will populate a struct tm with the
correct values but strftime() always assumes that the values are in local
time. I could manually adjust the struct tm values so that strftime() would
generate the desired string but it gets really ugly when the locale is west
of 0 degrees longitude. Furthermore, experimentation has shown that
strftime() can correctly adjust the values when they exceed the normal upper
range but not when they are negative (i.e. after an arbitrary subtraction
which would be required to adjust local time appropriately for locales west
of 0 degrees longitude). Would using putenv("TZ=UTC0DUT") with tzset()
solve the problem (assuming that I have no need of locally adjusted time)?
Any thoughts/help would be greatly appreciated. Thanks.
Mike