summaryrefslogtreecommitdiff
path: root/kernel/time/timeconv.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-06-21 09:22:51 +0300
committerThomas Gleixner <tglx@linutronix.de>2016-06-21 09:22:51 +0300
commitc7d6b5a22c00a19b513353469d89062264a7235f (patch)
treee693b4d3cd596471a2516529d6ef5c3ed9efcbdc /kernel/time/timeconv.c
parent86721ab63b61ef1dd7305308e4049f644703decf (diff)
parent7c71feb0a6766c7c3a262e3cc33ae231f3953cb6 (diff)
downloadlinux-c7d6b5a22c00a19b513353469d89062264a7235f.tar.xz
Merge branch 'fortglx/4.8/time' of https://git.linaro.org/people/john.stultz/linux into timers/core
Pull time(keeping) updates from John Stultz: - Handle the 1ns issue with the old refusing to die vsyscall machinery - More y2038 updates - Documentation fixes - Simplify clocksource handling
Diffstat (limited to 'kernel/time/timeconv.c')
-rw-r--r--kernel/time/timeconv.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/time/timeconv.c b/kernel/time/timeconv.c
index 86628e755f38..7142580ad94f 100644
--- a/kernel/time/timeconv.c
+++ b/kernel/time/timeconv.c
@@ -67,20 +67,21 @@ static const unsigned short __mon_yday[2][13] = {
#define SECS_PER_DAY (SECS_PER_HOUR * 24)
/**
- * time_to_tm - converts the calendar time to local broken-down time
+ * time64_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
*/
-void time_to_tm(time_t totalsecs, int offset, struct tm *result)
+void time64_to_tm(time64_t totalsecs, int offset, struct tm *result)
{
long days, rem, y;
+ int remainder;
const unsigned short *ip;
- days = totalsecs / SECS_PER_DAY;
- rem = totalsecs % SECS_PER_DAY;
+ days = div_s64_rem(totalsecs, SECS_PER_DAY, &remainder);
+ rem = remainder;
rem += offset;
while (rem < 0) {
rem += SECS_PER_DAY;
@@ -124,4 +125,4 @@ void time_to_tm(time_t totalsecs, int offset, struct tm *result)
result->tm_mon = y;
result->tm_mday = days + 1;
}
-EXPORT_SYMBOL(time_to_tm);
+EXPORT_SYMBOL(time64_to_tm);