how to convert from struct tm to long int in C?

c, linux

Solution

You can use the `mktime()` function to convert a `struct tm` into a `time_t`, which is an integer value.

Problem

this is a simple question ... is there a way to convert a `struct tm ct;` to a long integer ? here's how my code look like: ``` struct tm ct; scanf("%d", &ct.tm_sec); scanf("%d", &ct.tm_min); scanf("%d", &ct.tm_hour); scanf("%d", &ct.tm_mday); scanf("%d", &ct.tm_mon); scanf("%d", &ct.tm_year); ```

Original source