What I'm wanting to do it take a ctime() string and convert it to a tm struct. I know I can do this manually, but it seems like there should already be a function to do this.
ctime() returns a string in the format of Www Mmm dd hh:mm:ss yyyy.
Printable View
What I'm wanting to do it take a ctime() string and convert it to a tm struct. I know I can do this manually, but it seems like there should already be a function to do this.
ctime() returns a string in the format of Www Mmm dd hh:mm:ss yyyy.
The use of ctime() requires a time_t parameter. Why do you not use that same time_t parameter in either gmtime() or localtime() to yield the struct tm?
If that is not an option, then just use strptime().