[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Correct TZ Time

Posted on 2000-04-15
2
Medium Priority
?
244 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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

656 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