datetime string to seconds error
"
Code:
time_t epoch;
struct tm tm;
if (strptime("2011-10-23 08:46:10", "%Y-%m-%d %H:%M:%S", &tm) != NULL) {
epoch = mktime(&tm);
} else {
// Handle error
}
printf("seconds since the Epoch: %ld\n", (long) epoch);
I want to convert the string "2011-10-23 08:46:10" to seconds. Why am I getting this error with this code. warning: comparison between pointer and integer [enabled by default] for line
Code:
if (strptime("2011-10-23 08:46:10", "%Y-%m-%d %H:%M:%S", &tm) != NULL) {."