Hi, just wondering if I have a program which accepts a string name such as "paris" or "tokyo", how would I use any of the function in the <time.h> to display the correct time as specified by the city name? thanks in advance.
Hi, just wondering if I have a program which accepts a string name such as "paris" or "tokyo", how would I use any of the function in the <time.h> to display the correct time as specified by the city name? thanks in advance.
'The bigger they are, the harder they fall' ~Yang
I doubt u have a function to do that but you can get the time and use the time offset to get what u need...
Set up two arrays (or an array of struct) that contain the name and the time offset. Then use a time function to get a time structure. Add/subtract your time offset, fix any problems, convert to string and output.Originally Posted by godhand
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
Hi, could you give me an example which uses the time offset to get the correct time zone please?
'The bigger they are, the harder they fall' ~Yang
Never used it, but you might want to look into locale.h, it is standard, then get the "region" and then use a switch on what it returns or something. I have never used the header so don't even know if it is possible.
Help populate a c/c++ help irc channel
server: irc://irc.efnet.net
channel: #c
This is really simple. However, I'm not going to give you your answer, because you don't learn anything by having me do it for you. What is meant by an offset lookup is something like:
Now those were all off of the top of my head, but they're fairly close to accurate if not entirely. The point is, you assign a value to a given city. This is the time difference. Thus, you look up where they are, where they want to compare to, and add do a little math.Code:"Seattle", -8 "New York", -5 "London", 0
Quzah.
Hope is the first step on the road to disappointment.