summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2016-06-09 08:04:59 +0300
committerJohn Stultz <john.stultz@linaro.org>2016-06-20 22:47:15 +0300
commite6c2682a1da36a2e79d9bab470412374434ce89e (patch)
treeda24b0529e5ae9ed16b884a2a9fed43a5a3d5a53 /include
parentaf4afb40085f04f8b2ea8d28df878f7f0be02f89 (diff)
downloadlinux-e6c2682a1da36a2e79d9bab470412374434ce89e.tar.xz
time: Add time64_to_tm()
time_to_tm() takes time_t as an argument. time_t is not y2038 safe. Add time64_to_tm() that takes time64_t as an argument which is y2038 safe. The plan is to eventually replace all calls to time_to_tm() by time64_to_tm(). Cc: Prarit Bhargava <prarit@redhat.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/time.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index 297f09f23896..4cea09d94208 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -205,7 +205,20 @@ struct tm {
int tm_yday;
};
-void time_to_tm(time_t totalsecs, int offset, struct tm *result);
+void time64_to_tm(time64_t totalsecs, int offset, struct tm *result);
+
+/**
+ * time_to_tm - converts the calendar time to local broken-down time
+ *
+ * @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
+ * Coordinated Universal Time (UTC).
+ * @offset offset seconds adding to totalsecs.
+ * @result pointer to struct tm variable to receive broken-down time
+ */
+static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result)
+{
+ time64_to_tm(totalsecs, offset, result);
+}
/**
* timespec_to_ns - Convert timespec to nanoseconds