Juniper
Just your average being, of some form.
The infographic on carbon emissions per style of bicycle, with cars as the (predictably) most damaging bar on the graph is very interesting. I hadn’t anticipated materials in manufacturing to make quite this intense of a difference. Makes me glad I bought a 1980s steel frame junker that I maintain and repair as issues crop up, but that kind of “project bicycle” isn’t for everyone, let alone the compatibility issues driven by companies (likely to increase profit).
Something to keep in mind as I recommend bicycles to people who may not be as affectionate towards old beat up projects as I.
Using clock()
solely for delta values is absolutely a valid approach, as stated. The issue is that clock_t
may not be large enough of some systems to safely keep you from an overflow, especially with arbitrary values. Additionally, some systems will include the time children processes were alive in subsequent clock()
calls, furthering possible confusion. These are reasons why I would avoid clock()
in favor of time()
, even though your concerns are absolutely valid.
At the end of the day you have to determine which style of unpredictability you want to work around. Dealing with the times()
, clock()
, and clock_gettime()
class of functions opens you up to managing what the kernel considers time passed, and what is accumulated vs what is not. While using time()
can have shifts in time according to upstream NTP servers, as well as daylight savings time.
I would also make the argument that if an NTP server is adjusting your time, it is most likely more accurate than what your internal clock (CMOS or otherwise) was counting, and is worth following.
This is correct, however it is important to note that the C standard allows arbitrary values at the beginning of the program. The manpage does a better job explaining it.
Doing a bit of research, it looks like the POSIX time_t time(time_t *dest)
function (man) is available on Windows (see here). So I would recommend that over clock_t clock(void)
as it will operate more consistently across platforms.