I am using the struct timespec
structure and here it is:
struct timespec {
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds */
};
Thing is, user will be entering the values for each of these individual members, and i want to put a check a max. value the user can enter.
Can I take the max. value of time_t
as int max value? i.e INT_MAX
for tv_sec
and LONG_MAX
(defined in limits.h) for the tv_nsec
? What will be the minimum acceptable values for both? Is it zero? I guess negative values can't be accepted? Just to add, these values will be using in a timer.
P.S: Where is the typedef for time_t
? Could not find it in time.h.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…