Commit f4818900 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] hrtimer: clean up mktime and make arguments const

add 'const' to mktime arguments, and clean it up a bit
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 753be622
...@@ -38,9 +38,11 @@ static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) ...@@ -38,9 +38,11 @@ static __inline__ int timespec_equal(struct timespec *a, struct timespec *b)
return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
} }
extern unsigned long mktime (unsigned int year, unsigned int mon, extern unsigned long mktime(const unsigned int year, const unsigned int mon,
unsigned int day, unsigned int hour, const unsigned int day, const unsigned int hour,
unsigned int min, unsigned int sec); const unsigned int min, const unsigned int sec);
extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
extern struct timespec xtime; extern struct timespec xtime;
extern struct timespec wall_to_monotonic; extern struct timespec wall_to_monotonic;
...@@ -51,8 +53,6 @@ static inline unsigned long get_seconds(void) ...@@ -51,8 +53,6 @@ static inline unsigned long get_seconds(void)
return xtime.tv_sec; return xtime.tv_sec;
} }
extern void set_normalized_timespec (struct timespec *ts, time_t sec, long nsec);
struct timespec current_kernel_time(void); struct timespec current_kernel_time(void);
#define CURRENT_TIME (current_kernel_time()) #define CURRENT_TIME (current_kernel_time())
......
...@@ -599,11 +599,14 @@ EXPORT_SYMBOL_GPL(getnstimestamp); ...@@ -599,11 +599,14 @@ EXPORT_SYMBOL_GPL(getnstimestamp);
* will already get problems at other places on 2038-01-19 03:14:08) * will already get problems at other places on 2038-01-19 03:14:08)
*/ */
unsigned long unsigned long
mktime (unsigned int year, unsigned int mon, mktime(const unsigned int year0, const unsigned int mon0,
unsigned int day, unsigned int hour, const unsigned int day, const unsigned int hour,
unsigned int min, unsigned int sec) const unsigned int min, const unsigned int sec)
{ {
if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ unsigned int mon = mon0, year = year0;
/* 1..12 -> 11,12,1..10 */
if (0 >= (int) (mon -= 2)) {
mon += 12; /* Puts Feb last since it has leap day */ mon += 12; /* Puts Feb last since it has leap day */
year -= 1; year -= 1;
} }
...@@ -630,7 +633,7 @@ mktime (unsigned int year, unsigned int mon, ...@@ -630,7 +633,7 @@ mktime (unsigned int year, unsigned int mon,
* 0 <= tv_nsec < NSEC_PER_SEC * 0 <= tv_nsec < NSEC_PER_SEC
* For negative values only the tv_sec field is negative ! * For negative values only the tv_sec field is negative !
*/ */
void set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec)
{ {
while (nsec >= NSEC_PER_SEC) { while (nsec >= NSEC_PER_SEC) {
nsec -= NSEC_PER_SEC; nsec -= NSEC_PER_SEC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment