Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What will happen when seconds since epoch > LONG_MAX?

Tags:

c

time

epoch

time-t

For homework, I am writing a program that deals with a lot of time_t objects. I thought about checking them for overflow, but then it occurred to me that if they overflowed we would all be in a might bit of trouble.

Is there a plan for this? What will happen when the time since epoch exceeds storage?

like image 229
Ziggy Avatar asked Dec 28 '22 06:12

Ziggy


1 Answers

LONG_MAX on a 64-bit machine is 2^63 - 1. Try this: go to http://google.com and enter 2^63 seconds in years. Look at the answer and decide whether you really need to worry about it.

like image 68
rob mayoff Avatar answered Jan 08 '23 01:01

rob mayoff