Setting TimeZone with C++

N

Neo

Hi,
Can anybody help me in writing a standard C++ program to set timezone to CST ?
-Thanks,
Venkat
 
A

Ali R.

Neo said:
Hi,
Can anybody help me in writing a standard C++ program to set timezone to CST ?
-Thanks,
Venkat

There is no Time Zone in standard C++. Actually I don't think that your
computer really cares what timezone it's in, just the time.

Ali R.
 
D

Derek Baker

Neo said:
Hi,
Can anybody help me in writing a standard C++ program to set timezone to CST ?
-Thanks,
Venkat

What OS? Perhaps you should ask in a newsgroup for it.
 
E

Ekkehard Morgenstern

Hi Neo,

Neo said:
Can anybody help me in writing a standard C++ program to set timezone to
CST ?

Refer to the documentation of your compiler's or OS's libraries.

Most C libraries' time functions (defined in "time.h") evaluate an
environment variable (like TZ) to detect the time zone in a UNIX-compatible
manner. Some libraries contain functions like "tzset()" to set the time
zone. That stuff existed before C++ so it's an anachronism really.

It's better to write conditional code for every platform (operating system)
you want to support and use the platform's specific time zone function which
you find in the OS's programming documentation.

I hope that helps.

Regards,
Ekkehard Morgenstern.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top