473,657 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting TimeZone with C++

Neo
Hi,
Can anybody help me in writing a standard C++ program to set timezone to CST ?
-Thanks,
Venkat
Jul 19 '05 #1
3 11106

"Neo" <ni*******@yaho o.com> wrote in message
news:86******** *************** ***@posting.goo gle.com...
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.
Jul 19 '05 #2
"Neo" <ni*******@yaho o.com> wrote in message
news:86******** *************** ***@posting.goo gle.com...
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.

--
Derek
Jul 19 '05 #3

Hi Neo,

"Neo" <ni*******@yaho o.com> schrieb im Newsbeitrag
news:86******** *************** ***@posting.goo gle.com...
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.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3199
by: Jim Davis | last post by:
I'm (still) working on an ISO 8601 date parser. I want to convert at least the formats described here: http://www.w3.org/TR/NOTE-datetime Well.. I've got most of it working (via RegEx's) good enough for me but I'm having a brain block when it comes to TimeZone. The datetime may come with an optional timezone offset (from GMT) as here (the offset is +1 hour from GMT):
1
4018
by: cnliou | last post by:
Hi! If I correctly understand v7.4 manual, value, say, '2003-11-26 12:00' in TIMESTAMP WITHOUT TIMEZONE column should output '2003-11-26 19:00' for "+08:00" timezone. The following test results seem to be somewhat unexpected. Restting OS timezone (/etc/timezone and /etc/localtime in Linux) does not make the results more comfortable.
4
4791
by: Anony Mous | last post by:
Hi, Is there a function that would allow me to set the local time while the server is running? I can't seem to find anything on this... Thanks, Peter ---------------------------(end of broadcast)---------------------------
2
3694
by: Ken Varn | last post by:
I have a managed C++ method that I call from ASP.NET to set the time zone on the local box. I call SetTimeZoneInformation, which does not return an error, but the time zone remains unchanged. I have checked the web for any information on this, but have not found any articles that relate to this specific problem. Can anyone tell me what is wrong here? Here is a sample snippet of the method: Note that TimeZoneInfo is my own managed...
0
1786
by: jrhastings | last post by:
I know there are many threads on this topic but I haven't yet found an answer to this question. I'd like to map from a utc to a local time in an arbitrary timezone (not necessary the default local timezone). To do this on UNIX is relatively straightforward by setting the TZ environment variable (and calling time.tzset()). On Windows, one can get close to the answer using the pytz module (to load the timezone based on the standard UNIX...
0
3208
by: helloitsme | last post by:
Hello All! I know there already exists a thread with this topic by Mike! But my problem did not get solved with that.... I have a working code in VB6 that can set the selected timezone for the system. When i converted that code in VB .NET, I am having a problem similar to what Mike was having. When I select my timezone to Eastern Time Zone (or SA Pacific), my code sets my system timezone to 'Bogota, Lima, Quito'. i guess it is becoz both...
3
3193
by: mac11 | last post by:
I have an app that runs under Linux (centos and LFS flavors) and I'm having problems with reading the correct time after I change the timezone (by moving the link at /etc/localtime to point to the new timezone file) Basically, I use a call to time() to get the current time - and when I change the timezone while my app is running the call to time() does not reflect the new timezone unless I kill it and restart. Is there some environment...
4
8411
by: bill | last post by:
I am using the MySQL date and time functions and they save a lot of my time. But the server is located in a time zone 2 hours away. I read in the SQL docs how to set the timezone on a per-connection basis, but how would I do that from PHP ? bill
2
3318
by: SvenV | last post by:
Hello, I'm looking for a way to set the timezone on a mobile (windows CE4.0). I know there is no specific function in .NET1.1 and by looking on pinvoke.net: HomePage (misc) between coredll I understand that there is no API function to do the trick. The scenario is the following: I have a server which sends out his dateTime information using the following format "yyyyMMdd zzz" . This returns the date + timezone. This reaches the mobile as a...
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.