diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-09 23:52:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:35 -0500 |
commit | f4818900fa3ee1c56e96f6dede7cc4c05ed383d1 (patch) | |
tree | 63a53f60a01a33c1c6e755ba16b05de33008bb3d /kernel | |
parent | 753be6222728996974e9e12c185108fcabbb7c6e (diff) |
[PATCH] hrtimer: clean up mktime and make arguments const
add 'const' to mktime arguments, and clean it up a bit
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/time.c b/kernel/time.c index fa569885e22b..a0502aef43ce 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -599,12 +599,15 @@ EXPORT_SYMBOL_GPL(getnstimestamp); | |||
599 | * will already get problems at other places on 2038-01-19 03:14:08) | 599 | * will already get problems at other places on 2038-01-19 03:14:08) |
600 | */ | 600 | */ |
601 | unsigned long | 601 | unsigned long |
602 | mktime (unsigned int year, unsigned int mon, | 602 | mktime(const unsigned int year0, const unsigned int mon0, |
603 | unsigned int day, unsigned int hour, | 603 | const unsigned int day, const unsigned int hour, |
604 | unsigned int min, unsigned int sec) | 604 | const unsigned int min, const unsigned int sec) |
605 | { | 605 | { |
606 | if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ | 606 | unsigned int mon = mon0, year = year0; |
607 | mon += 12; /* Puts Feb last since it has leap day */ | 607 | |
608 | /* 1..12 -> 11,12,1..10 */ | ||
609 | if (0 >= (int) (mon -= 2)) { | ||
610 | mon += 12; /* Puts Feb last since it has leap day */ | ||
608 | year -= 1; | 611 | year -= 1; |
609 | } | 612 | } |
610 | 613 | ||
@@ -630,7 +633,7 @@ mktime (unsigned int year, unsigned int mon, | |||
630 | * 0 <= tv_nsec < NSEC_PER_SEC | 633 | * 0 <= tv_nsec < NSEC_PER_SEC |
631 | * For negative values only the tv_sec field is negative ! | 634 | * For negative values only the tv_sec field is negative ! |
632 | */ | 635 | */ |
633 | void set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) | 636 | void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec) |
634 | { | 637 | { |
635 | while (nsec >= NSEC_PER_SEC) { | 638 | while (nsec >= NSEC_PER_SEC) { |
636 | nsec -= NSEC_PER_SEC; | 639 | nsec -= NSEC_PER_SEC; |