Q: conversion between timezones 
Author Message
 Q: conversion between timezones

I have hoping someone could help me with a couple of
questions.
1) strftime() converts time string into struct tm but
it does not fill in timezone and gmtoff fields.  Are
there some functions which will do that given a
timezone string?
2) I was trying to convert time in struct tm into the
system's timezone.  I created a struct tm and
explicitly set timezone to "EDT" and gmtoff to -14400L.
Then I called timelocal() to convert it into a time_t
and then use localtime() to convert the time_t back to
a struct tm.  It did not give me the desired result but
simply replaced the timezone field back to "PDT", my
system's timezone.  What was the thing that I did
wrong?  Is there some better ways of doing it?

You help is appreciated.
--
-----
-hoki



Mon, 13 Apr 1998 03:00:00 GMT  
 Q: conversion between timezones

Quote:

>I have hoping someone could help me with a couple of
>questions.
>1) strftime() converts time string into struct tm but
>it does not fill in timezone and gmtoff fields.  Are
>there some functions which will do that given a
>timezone string?

timezone and gmtoff are not standard members of a struct tm, so the language
provides no support for them. You will need you find out what support
your particular system provides or find some other way of doing what you
want.

Quote:
>2) I was trying to convert time in struct tm into the
>system's timezone.  I created a struct tm and
>explicitly set timezone to "EDT" and gmtoff to -14400L.
>Then I called timelocal() to convert it into a time_t

timelocal() is not a standard C function.

Quote:
>and then use localtime() to convert the time_t back to
>a struct tm.  It did not give me the desired result but
>simply replaced the timezone field back to "PDT", my
>system's timezone.  What was the thing that I did
>wrong?  Is there some better ways of doing it?

Your best bet is to post in a newsgroup relevant to your particular
system.

--
-----------------------------------------


-----------------------------------------



Tue, 14 Apr 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. --- Recap: Qs. about struct ---

2. Qs of getrusage()

3. Qs on Function Call on Array

4. C's Qs

5. four Qs about C

6. strtok() Qs.

7. Borland open/_rtl_open/sopen Qs

8. Various Qs on raw_interfaces_only, no_namespace, throw, smartpointers

9. VERBATUM EXAM Qs 50929

10. 2 GUI Qs

11. Qs about MS VC++

12. Two Qs on MFC in VC.NET

 

 
Powered by phpBB® Forum Software