Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
9f4646d2
Commit
9f4646d2
authored
Feb 14, 2013
by
Thomas Gleixner
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fortglx/3.9/time' of
git://git.linaro.org/people/jstultz/linux
into timers/core
parents
86c8ead5
84e345e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
include/linux/time.h
include/linux/time.h
+1
-0
kernel/time.c
kernel/time.c
+8
-0
kernel/time/ntp.c
kernel/time/ntp.c
+6
-2
No files found.
include/linux/time.h
View file @
9f4646d2
...
@@ -128,6 +128,7 @@ static inline bool has_persistent_clock(void)
...
@@ -128,6 +128,7 @@ static inline bool has_persistent_clock(void)
extern
void
read_persistent_clock
(
struct
timespec
*
ts
);
extern
void
read_persistent_clock
(
struct
timespec
*
ts
);
extern
void
read_boot_clock
(
struct
timespec
*
ts
);
extern
void
read_boot_clock
(
struct
timespec
*
ts
);
extern
int
persistent_clock_is_local
;
extern
int
update_persistent_clock
(
struct
timespec
now
);
extern
int
update_persistent_clock
(
struct
timespec
now
);
void
timekeeping_init
(
void
);
void
timekeeping_init
(
void
);
extern
int
timekeeping_suspended
;
extern
int
timekeeping_suspended
;
...
...
kernel/time.c
View file @
9f4646d2
...
@@ -114,6 +114,12 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
...
@@ -114,6 +114,12 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
return
0
;
return
0
;
}
}
/*
* Indicates if there is an offset between the system clock and the hardware
* clock/persistent clock/rtc.
*/
int
persistent_clock_is_local
;
/*
/*
* Adjust the time obtained from the CMOS to be UTC time instead of
* Adjust the time obtained from the CMOS to be UTC time instead of
* local time.
* local time.
...
@@ -135,6 +141,8 @@ static inline void warp_clock(void)
...
@@ -135,6 +141,8 @@ static inline void warp_clock(void)
struct
timespec
adjust
;
struct
timespec
adjust
;
adjust
=
current_kernel_time
();
adjust
=
current_kernel_time
();
if
(
sys_tz
.
tz_minuteswest
!=
0
)
persistent_clock_is_local
=
1
;
adjust
.
tv_sec
+=
sys_tz
.
tz_minuteswest
*
60
;
adjust
.
tv_sec
+=
sys_tz
.
tz_minuteswest
*
60
;
do_settimeofday
(
&
adjust
);
do_settimeofday
(
&
adjust
);
}
}
...
...
kernel/time/ntp.c
View file @
9f4646d2
...
@@ -511,13 +511,17 @@ static void sync_cmos_clock(struct work_struct *work)
...
@@ -511,13 +511,17 @@ static void sync_cmos_clock(struct work_struct *work)
getnstimeofday
(
&
now
);
getnstimeofday
(
&
now
);
if
(
abs
(
now
.
tv_nsec
-
(
NSEC_PER_SEC
/
2
))
<=
tick_nsec
/
2
)
{
if
(
abs
(
now
.
tv_nsec
-
(
NSEC_PER_SEC
/
2
))
<=
tick_nsec
/
2
)
{
struct
timespec
adjust
=
now
;
fail
=
-
ENODEV
;
fail
=
-
ENODEV
;
if
(
persistent_clock_is_local
)
adjust
.
tv_sec
-=
(
sys_tz
.
tz_minuteswest
*
60
);
#ifdef CONFIG_GENERIC_CMOS_UPDATE
#ifdef CONFIG_GENERIC_CMOS_UPDATE
fail
=
update_persistent_clock
(
now
);
fail
=
update_persistent_clock
(
adjust
);
#endif
#endif
#ifdef CONFIG_RTC_SYSTOHC
#ifdef CONFIG_RTC_SYSTOHC
if
(
fail
==
-
ENODEV
)
if
(
fail
==
-
ENODEV
)
fail
=
rtc_set_ntp_time
(
now
);
fail
=
rtc_set_ntp_time
(
adjust
);
#endif
#endif
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment