diff options
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r-- | arch/powerpc/kernel/time.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index ad63f30fe3da..a508388fb87c 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -774,6 +774,7 @@ void read_persistent_clock(struct timespec *ts) | |||
774 | struct rtc_time tm; | 774 | struct rtc_time tm; |
775 | static int first = 1; | 775 | static int first = 1; |
776 | 776 | ||
777 | ts->tv_nsec = 0; | ||
777 | /* XXX this is a litle fragile but will work okay in the short term */ | 778 | /* XXX this is a litle fragile but will work okay in the short term */ |
778 | if (first) { | 779 | if (first) { |
779 | first = 0; | 780 | first = 0; |
@@ -781,15 +782,18 @@ void read_persistent_clock(struct timespec *ts) | |||
781 | timezone_offset = ppc_md.time_init(); | 782 | timezone_offset = ppc_md.time_init(); |
782 | 783 | ||
783 | /* get_boot_time() isn't guaranteed to be safe to call late */ | 784 | /* get_boot_time() isn't guaranteed to be safe to call late */ |
784 | if (ppc_md.get_boot_time) | 785 | if (ppc_md.get_boot_time) { |
785 | return ppc_md.get_boot_time() -timezone_offset; | 786 | ts->tv_sec = ppc_md.get_boot_time() - timezone_offset; |
787 | return; | ||
788 | } | ||
789 | } | ||
790 | if (!ppc_md.get_rtc_time) { | ||
791 | ts->tv_sec = 0; | ||
792 | return; | ||
786 | } | 793 | } |
787 | if (!ppc_md.get_rtc_time) | ||
788 | return 0; | ||
789 | ppc_md.get_rtc_time(&tm); | 794 | ppc_md.get_rtc_time(&tm); |
790 | ts->tv_sec = mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, | 795 | ts->tv_sec = mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, |
791 | tm.tm_hour, tm.tm_min, tm.tm_sec); | 796 | tm.tm_hour, tm.tm_min, tm.tm_sec); |
792 | ts->tv_nsec = 0; | ||
793 | } | 797 | } |
794 | 798 | ||
795 | /* clocksource code */ | 799 | /* clocksource code */ |