
Adding time64_t definition will help improve portability of linux kernel code (in my case, lib/crypto/x509_cert_parser.c).
Signed-off-by: AKASHI Takahiro takahiro.akashi@linaro.org --- include/linux/time.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/include/linux/time.h b/include/linux/time.h index b8d298eb4d68..6186985856d7 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -150,4 +150,28 @@ _DEFUN (ctime_r, (tim_p, result), return asctime_r (localtime_r (tim_p, &tm), result); }
+/* from <linux>/kernel/time/time.c */ +typedef __s64 time64_t; + +inline time64_t mktime64(const unsigned int year0, const unsigned int mon0, + const unsigned int day, const unsigned int hour, + const unsigned int min, const unsigned int sec) +{ + unsigned int mon = mon0, year = year0; + + /* 1..12 -> 11,12,1..10 */ + mon -= 2; + if (0 >= (int)mon) { + mon += 12; /* Puts Feb last since it has leap day */ + year -= 1; + } + + return ((((time64_t) + (year / 4 - year / 100 + year / 400 + 367 * mon / 12 + day) + + year * 365 - 719499 + ) * 24 + hour /* now have hours - midnight tomorrow handled here */ + ) * 60 + min /* now have minutes */ + ) * 60 + sec; /* finally seconds */ +} + #endif