summaryrefslogtreecommitdiffstats
path: root/include/linux/time.h
diff options
context:
space:
mode:
authorpang.xunlei <pang.xunlei@linaro.org>2014-11-18 19:15:18 +0800
committerJohn Stultz <john.stultz@linaro.org>2014-11-21 11:59:58 -0800
commit90b6ce9c4066e0b2098dff65e52e6e7df1a51079 (patch)
treed92267d1b186332bdc827850e72c3f7a4b0b600b /include/linux/time.h
parent04d9089086a8231ddc69a9f3f25e971a3c1d25e6 (diff)
downloadlinux-90b6ce9c4066e0b2098dff65e52e6e7df1a51079.tar.gz
linux-90b6ce9c4066e0b2098dff65e52e6e7df1a51079.tar.xz
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>
Diffstat (limited to 'include/linux/time.h')
-rw-r--r--include/linux/time.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index 8c42cf8d2444..203c2ad40d71 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -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);