Hi people!
Here is the solution that I create. If someone think that it can be improved in any way or there may be another solution please let me know.
Thanks
#include <stdio.h>
#include <time.h>
int main(int argc, const char * argv[]) {
printf ("===== Structs Challenge =====\n\n");
struct tm now;
/* Today's Date */
/* I add +1 to now.tm_now (months from January up to now [0-11]) in order to adjust to the normal format */
/* I add +1900 to now.tm_year (years from 1900 up to now) in order to adjust to the normal format */
long secondsSince1970 = time (NULL);
localtime_r (&secondsSince1970, &now);
printf ("Today's date --> %d-%d-%d\n\n", now.tm_mon + 1, now.tm_mday, now.tm_year + 1900);
/* Date in 4 million seconds */
/* I add +4 million seconds to the amount of seconds since 1970 up to now in order to know how many seconds have passed since 1970 to a 4 million seconds future since present time, so that I can calculate date in 4 million seconds using localtime_r */
secondsSince1970 += 4000000;
localtime_r (&secondsSince1970, &now);
printf ("Date in 4 million seconds --> %d-%d-%d\n", now.tm_mon + 1, now.tm_mday, now.tm_year + 1900);
}
+++++++++++++++ OUTPUT ++++++++++++++++
===== Structs Challenge =====
Today’s date --> 7-22-2015
Date in 4 million seconds --> 9-7-2015