Solved

Correct TZ Time

Posted on 2000-04-15
2
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XCode crashes while uploading to app store. 5 270
Adjust Mfcapp 29 178
why "." vs "->" 23 120
Problem to show menu 5 98
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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

730 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