I am trying to get a date and time from the user and then store it into a tm struct. Then convert it into a time_t type for storage. When I need it again I want to convert the time_t type back into a tm struct and print it out or change it.
However when I do this it does not contain the same values that I first put into the tm struct. I believe the problem lies with mktime().
Below is a simplified version of my program. Am I doing something wrong?
I found out that I needed to set the tm_sec and tm_isdst members as well.
I also noticed that having two asctime() calls in the same cout statement goofs up. The second one will just print out the same thing the first one did. Can anyone tell me why?