diff options
| author | Anton Altaparmakov <aia21@cantab.net> | 2006-02-24 04:06:36 -0500 |
|---|---|---|
| committer | Anton Altaparmakov <aia21@cantab.net> | 2006-02-24 04:06:36 -0500 |
| commit | fab8d6ddf6dee2608869005d45fe97f70e4f5bdd (patch) | |
| tree | fecf566e03a87b2a44c7f3363ddb5c0d4bebdca7 /kernel/time.c | |
| parent | 64419d93a5906600af5817ad0cae3c6ecf7fb389 (diff) | |
| parent | f52ee1410d563cd409b08822492273a5bc235821 (diff) | |
Merge branch 'master' of /home/src/linux-2.6/
Diffstat (limited to 'kernel/time.c')
| -rw-r--r-- | kernel/time.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/time.c b/kernel/time.c index 7477b1d2079e..804539165d8b 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
| @@ -155,7 +155,7 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz) | |||
| 155 | static int firsttime = 1; | 155 | static int firsttime = 1; |
| 156 | int error = 0; | 156 | int error = 0; |
| 157 | 157 | ||
| 158 | if (!timespec_valid(tv)) | 158 | if (tv && !timespec_valid(tv)) |
| 159 | return -EINVAL; | 159 | return -EINVAL; |
| 160 | 160 | ||
| 161 | error = security_settime(tv, tz); | 161 | error = security_settime(tv, tz); |
| @@ -637,15 +637,16 @@ void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec) | |||
| 637 | * | 637 | * |
| 638 | * Returns the timespec representation of the nsec parameter. | 638 | * Returns the timespec representation of the nsec parameter. |
| 639 | */ | 639 | */ |
| 640 | inline struct timespec ns_to_timespec(const nsec_t nsec) | 640 | struct timespec ns_to_timespec(const nsec_t nsec) |
| 641 | { | 641 | { |
| 642 | struct timespec ts; | 642 | struct timespec ts; |
| 643 | 643 | ||
| 644 | if (nsec) | 644 | if (!nsec) |
| 645 | ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, | 645 | return (struct timespec) {0, 0}; |
| 646 | &ts.tv_nsec); | 646 | |
| 647 | else | 647 | ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, &ts.tv_nsec); |
| 648 | ts.tv_sec = ts.tv_nsec = 0; | 648 | if (unlikely(nsec < 0)) |
| 649 | set_normalized_timespec(&ts, ts.tv_sec, ts.tv_nsec); | ||
| 649 | 650 | ||
| 650 | return ts; | 651 | return ts; |
| 651 | } | 652 | } |
