• C

Correct TZ Time

I have a program that saves the time as GMT instead of the current timezone on a UNIX box. How do I modify this snippit to produce the correct time zone time?

(part of an fprintf statement)



Who is Participating?
xLsConnect With a Mentor Commented:
pasted from msdnlibrary:

Converts a time value and corrects for the local time zone.

struct tm *localtime( const time_t *timer );

or without correction of time zone

Converts a time value to a structure.

struct tm *gmtime( const time_t *timer );

hope this would help.

bruthAuthor Commented:
I had a previous line referencing gmtime and I changed it to localtime as you suggested. Solved the issue perfectly.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.