Solved

Correct TZ Time

Posted on 2000-04-15
2
186 Views
Last Modified: 2010-04-02
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)

c=mygethostbyaddr((char*)&trans->data.trans.client.s_addr),timestamp->tm_mday,monthname[timestamp->tm_mon],timestamp->tm_year+1900,timestamp->tm_hour,timestamp->tm_min,timestamp->tm_sec;

Thanks,
Brian

0
Comment
Question by:bruth
2 Comments
 
LVL 2

Accepted Solution

by:
xLs earned 100 total points
ID: 2719819
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.

0
 

Author Comment

by:bruth
ID: 2732438
I had a previous line referencing gmtime and I changed it to localtime as you suggested. Solved the issue perfectly.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now