mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
time: Provide y2038 safe mktime() replacement
As part of addressing "y2038 problem" for in-kernel uses, this patch adds safe mktime64() using time64_t. After this patch, mktime() is deprecated and all its call sites will be fixed using mktime64(), after that it can be removed. Signed-off-by: pang.xunlei <pang.xunlei@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
parent
04d9089086
commit
90b6ce9c40
2 changed files with 22 additions and 15 deletions
|
@ -39,9 +39,20 @@ static inline int timeval_compare(const struct timeval *lhs, const struct timeva
|
|||
return lhs->tv_usec - rhs->tv_usec;
|
||||
}
|
||||
|
||||
extern unsigned long mktime(const unsigned int year, const unsigned int mon,
|
||||
const unsigned int day, const unsigned int hour,
|
||||
const unsigned int min, const unsigned int sec);
|
||||
extern time64_t mktime64(const unsigned int year, const unsigned int mon,
|
||||
const unsigned int day, const unsigned int hour,
|
||||
const unsigned int min, const unsigned int sec);
|
||||
|
||||
/**
|
||||
* Deprecated. Use mktime64().
|
||||
*/
|
||||
static inline unsigned long mktime(const unsigned int year,
|
||||
const unsigned int mon, const unsigned int day,
|
||||
const unsigned int hour, const unsigned int min,
|
||||
const unsigned int sec)
|
||||
{
|
||||
return mktime64(year, mon, day, hour, min, sec);
|
||||
}
|
||||
|
||||
extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue