Convert local time to gmt time without using TimeZone Env variable 
Author Message
 Convert local time to gmt time without using TimeZone Env variable

The ftcs unix mktime use the function tzset to initialize time
conversion information by setting an environment variable. That is not
thread-safe.

As I want to work in multi_threaded design with different time-zone, one
per each thread, I can't use the unix standard fonctions like mktime. I
need a thread-safe function that converts a local-time attached to its
timezone into a GMT time as follow:

    void localtime_to_gmt(const char * timezone,  const struct tm
localtime,  time_t * gmt_time);

Is there a  sofftware which uses instead of TZ env variable a local time
zone variable attached to the process to convert a local time to GMT ?

Thanks for your help ?

Fran?ois REYGAGNE. Software Architect.
opt[e]way S.A., 2881 route des Crtes, BP308
06906 Sophia Antipolis Cedex, FRANCE
tl: +33 (0)4 92 95 27 01
fax: +33 (0)4 92 95 26 01



Mon, 22 Sep 2003 23:36:10 GMT  
 Convert local time to gmt time without using TimeZone Env variable
On Thu, 05 Apr 2001 17:36:10 +0200, francois reygagne

Quote:
> The ftcs unix mktime use the function tzset to initialize time
> conversion information by setting an environment variable. That is not
> thread-safe.

There ARE NO threads in the C language.

Quote:
> As I want to work in multi_threaded design with different time-zone, one
> per each thread, I can't use the unix standard fonctions like mktime. I
> need a thread-safe function that converts a local-time attached to its
> timezone into a GMT time as follow:

mktime() is a C standard function, thread-safe functions are off-topic
here because the language does not define or support multiple threads
of execution.

Quote:
>     void localtime_to_gmt(const char * timezone,  const struct tm
> localtime,  time_t * gmt_time);

> Is there a  sofftware which uses instead of TZ env variable a local time
> zone variable attached to the process to convert a local time to GMT ?

> Thanks for your help ?

> Fran?ois REYGAGNE. Software Architect.
> opt[e]way S.A., 2881 route des Crtes, BP308
> 06906 Sophia Antipolis Cedex, FRANCE
> tl: +33 (0)4 92 95 27 01
> fax: +33 (0)4 92 95 26 01

The places where you should be asking this question are groups like

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq



Tue, 23 Sep 2003 08:29:58 GMT  
 Convert local time to gmt time without using TimeZone Env variable

Quote:

> On Thu, 05 Apr 2001 17:36:10 +0200, francois reygagne

> > The ftcs unix mktime use the function tzset to initialize time
> > conversion information by setting an environment variable. That is not
> > thread-safe.

> There ARE NO threads in the C language.

> > As I want to work in multi_threaded design with different time-zone, one
> > per each thread, I can't use the unix standard fonctions like mktime. I
> > need a thread-safe function that converts a local-time attached to its
> > timezone into a GMT time as follow:

> mktime() is a C standard function, thread-safe functions are off-topic
> here because the language does not define or support multiple threads
> of execution.

Even so, I think it is short sighted to ignore their existence.
Ideally the compiler and run-time system masks all these problems,
yet we all know that that is not universally true.  Many early C
libraries were shockingly unusable because of re-entrancy
problems, and today we don't worry much about it.

For example, the OPs program could maintain it's own TZ variable,
and also knowledge of the systems TZ.  That way it could apply its
own corrections as needed, using nothing that is non-standard C.

--

http://www.qwikpages.com/backstreets/cbfalconer
   (Remove "NOSPAM." from reply address. my-deja works unmodified)



Tue, 23 Sep 2003 10:51:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to convert local time to gmt using a local variable time zone per process/thread

2. How to convert GMT time to local time?

3. GMT time and Local time ?

4. Q: How to convert GMT to local time?

5. Converting GMT to local time

6. How to convert local time with specific time zone to UTC time in Win32 API

7. Converting UTC time to local time

8. converting from Local Time to UTC time...

9. What is purpose of abstract TimeZone class and how do I convert a local time to another local time?

10. GMT to local time conv

11. time confusion. I want time now GMT

12. howDoI convert a time from GMT to PST

 

 
Powered by phpBB® Forum Software