According to this documentation http://www.cplusplus.com/reference/clibrary/ctime/time/
for time(NULL) “If the function could not retrieve the calendar time, it returns a -1 value.”
Is this something I should check for in my code? Surely something has got to be going pretty wrong if time(NULL) is not retrieving the time.
You may be running on an embedded device that doesn’t have a real-time clock.
The glibc source code claims that the time syscall can’t fail on Linux:
and indeed this is the case if you look at the kernel source: