It’s been a while since you asked about this, but I figured I’d attempt to explain his code for your benefit, but also for my own:
To start off, you need to figure out what time it is now. The challenge asks for the date (and you could also do the time) 4 million seconds from right now. In order to get that time, you need to start with the time now and add 4 million seconds. ctmpkmlec4 decided to store the 4 million seconds in a variable called futureSeconds, so he creates a long integer and assigns it a value of 4,000,000. This way, you can find out what time it is any number of seconds in the future by just changing this value. He then creates a long integer variable called secondsSince1970 and uses the time() function to store the number of seconds since 1970 until now (almost exactly as noted in the book). He then adds the two variables together to get the number of seconds 4,000,000 seconds from now and prints a string to that effect.
In the next block, he creates a variable based on the time structure mentioned in the book called “future”. This structure, as shown in the book, can contain 11 different components of time, namely - seconds, minutes, hours, days, months, years, etc. This is just going to be a placeholder for the time so that we can pull the individual components out of whatever time we give it. That’s what the next function is for: localtime_r takes in an address where we’ve stored the time we want to figure out and then another address for the struct we created earlier (currently empty) where we can store the time components (minutes, hours, days, etc.) and spits each of those components out and saves them into our struct. When the localtime_r function is done, we should have a future structure that has all of the minutes, hours, days, etc. since 1970 plus an additional 4 million seconds.
The very last string, just prints out that statement to the log while adding 1 to the month (since it starts at 0 for January instead of 1), the day of the month, and the number of years since 1900 + 1900 (since leaving off the 1900 simply gives you 113 because that’s how many years it’s been since).
I hope this helps. I’ve tried to be really, really explicit (moreso for my own understanding) so please don’t take it as me talking down or anything. I just want to make sure I touched on everything.
Let me know if you have any other questions or if something I said was more confusing.