I\'m writing a simple program, which checks if elapsed time is more than 1 seconds. I take start time with a clock_gettime(), then I call sleep(5), take new time and I check if
You are using the nsec (nanoseconds) portion of the timestamps and totally ignoring the sec (seconds) part. Those timestamps are composed of two integers, and to get any meaning from them you need both.