I'm trying to write a sample app. to find out the time on a computer and convert it to mountain time.
I'm new to this stuff, and I found out some stuff on _ftime which gives you the timezone that is the "Difference in minutes, moving westward, between UTC and local time. The value of timezone is set from the value of the global variable _timezone (see _tzset)."
I'm not sure what UTC is and if this is the write method I should be using for what I'm doing.
Can someone please suggest to me what I can do or is there some tutorial or sample code out there which has something similar to what i'm doing here?
Is mountain time the time zone for you and is your system set to that timezone? Will all systems using this software have their timezones set to mountain time?
Yes, UTC is very appropriate for use in this manner. You can use a function that gets the current UTC and then use a function that converts UTC to the time appropriate for your system. The C runtime functions can do that. In that way, the software will be flexible enough that it is likely to work in any timezone.
However if you need to convert to mountan time but mountain time is not the local time, then things are more complicated.
Hi Sam, actually I have an app. that basically reads from a file that contains times in mountain time. Potentially this app may sit somewhere on a machine in a different timezone. The reason why I would like to figure out how to convert to mountain time, (not change it) is because I want to take the time on the person's machine (whatever timezone it is) and then see what it is in mountain time so that the time in the file makes sense.
I guess the thing i would be using is GetTimeZoneInformation and use the bias and also bring in the bias from the mountain time into the equation.