Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
timekeeping.c File Reference
#include <linux/timekeeper_internal.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/percpu.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/syscore_ops.h>
#include <linux/clocksource.h>
#include <linux/jiffies.h>
#include <linux/time.h>
#include <linux/tick.h>
#include <linux/stop_machine.h>

Go to the source code of this file.

Macros

#define old_vsyscall_fixup(tk)
 

Functions

__cacheline_aligned_in_smp DEFINE_SEQLOCK (xtime_lock)
 
void getnstimeofday (struct timespec *ts)
 
 EXPORT_SYMBOL (getnstimeofday)
 
ktime_t ktime_get (void)
 
 EXPORT_SYMBOL_GPL (ktime_get)
 
void ktime_get_ts (struct timespec *ts)
 
 EXPORT_SYMBOL_GPL (ktime_get_ts)
 
void do_gettimeofday (struct timeval *tv)
 
 EXPORT_SYMBOL (do_gettimeofday)
 
int do_settimeofday (const struct timespec *tv)
 
 EXPORT_SYMBOL (do_settimeofday)
 
int timekeeping_inject_offset (struct timespec *ts)
 
 EXPORT_SYMBOL (timekeeping_inject_offset)
 
void timekeeping_notify (struct clocksource *clock)
 
ktime_t ktime_get_real (void)
 
 EXPORT_SYMBOL_GPL (ktime_get_real)
 
void getrawmonotonic (struct timespec *ts)
 
 EXPORT_SYMBOL (getrawmonotonic)
 
int timekeeping_valid_for_hres (void)
 
u64 timekeeping_max_deferment (void)
 
void __attribute__ ((weak))
 
void __init timekeeping_init (void)
 
void timekeeping_inject_sleeptime (struct timespec *delta)
 
 device_initcall (timekeeping_init_ops)
 
void getboottime (struct timespec *ts)
 
 EXPORT_SYMBOL_GPL (getboottime)
 
void get_monotonic_boottime (struct timespec *ts)
 
 EXPORT_SYMBOL_GPL (get_monotonic_boottime)
 
ktime_t ktime_get_boottime (void)
 
 EXPORT_SYMBOL_GPL (ktime_get_boottime)
 
void monotonic_to_bootbased (struct timespec *ts)
 
 EXPORT_SYMBOL_GPL (monotonic_to_bootbased)
 
unsigned long get_seconds (void)
 
 EXPORT_SYMBOL (get_seconds)
 
struct timespec __current_kernel_time (void)
 
struct timespec current_kernel_time (void)
 
 EXPORT_SYMBOL (current_kernel_time)
 
struct timespec get_monotonic_coarse (void)
 
void do_timer (unsigned long ticks)
 
void get_xtime_and_monotonic_and_sleep_offset (struct timespec *xtim, struct timespec *wtom, struct timespec *sleep)
 
ktime_t ktime_get_monotonic_offset (void)
 
 EXPORT_SYMBOL_GPL (ktime_get_monotonic_offset)
 
void xtime_update (unsigned long ticks)
 

Variables

int __read_mostly timekeeping_suspended
 

Macro Definition Documentation

#define old_vsyscall_fixup (   tk)

Definition at line 1089 of file timekeeping.c.

Function Documentation

void __attribute__ ( (weak)  )
read

read_persistent_clock - Return time from the persistent clock.

Weak dummy function for arches that do not yet support it. Reads the time from the battery backed persistent clock. Returns a timespec with tv_sec=0 and tv_nsec=0 if unsupported.

XXX - Do be sure to remove it once all arches implement it.

read_boot_clock - Return time of the system start.

Weak dummy function for arches that do not yet support it. Function to read the exact time the system has been started. Returns a timespec with tv_sec=0 and tv_nsec=0 if unsupported.

XXX - Do be sure to remove it once all arches implement it.

Definition at line 567 of file timekeeping.c.

struct timespec __current_kernel_time ( void  )
read

Definition at line 1260 of file timekeeping.c.

struct timespec current_kernel_time ( void  )
read

Definition at line 1267 of file timekeeping.c.

__cacheline_aligned_in_smp DEFINE_SEQLOCK ( xtime_lock  )
device_initcall ( timekeeping_init_ops  )
void do_gettimeofday ( struct timeval tv)

do_gettimeofday - Returns the time of day in a timeval : pointer to the timeval to be set

NOTE: Users should be converted to using getnstimeofday()

Definition at line 346 of file timekeeping.c.

int do_settimeofday ( const struct timespec tv)

do_settimeofday - Sets the time of day : pointer to the timespec variable containing the new time

Sets the time of day to the new time and update NTP and notify hrtimers

Definition at line 362 of file timekeeping.c.

void do_timer ( unsigned long  ticks)

Definition at line 1306 of file timekeeping.c.

EXPORT_SYMBOL ( getnstimeofday  )
EXPORT_SYMBOL ( do_gettimeofday  )
EXPORT_SYMBOL ( do_settimeofday  )
EXPORT_SYMBOL ( timekeeping_inject_offset  )
EXPORT_SYMBOL ( getrawmonotonic  )
EXPORT_SYMBOL ( get_seconds  )
EXPORT_SYMBOL ( current_kernel_time  )
EXPORT_SYMBOL_GPL ( ktime_get  )
EXPORT_SYMBOL_GPL ( ktime_get_ts  )
EXPORT_SYMBOL_GPL ( ktime_get_real  )
EXPORT_SYMBOL_GPL ( getboottime  )
EXPORT_SYMBOL_GPL ( get_monotonic_boottime  )
EXPORT_SYMBOL_GPL ( ktime_get_boottime  )
EXPORT_SYMBOL_GPL ( monotonic_to_bootbased  )
EXPORT_SYMBOL_GPL ( ktime_get_monotonic_offset  )
void get_monotonic_boottime ( struct timespec ts)

get_monotonic_boottime - Returns monotonic time since boot : pointer to the timespec to be set

Returns the monotonic time since boot in a timespec.

This is similar to CLOCK_MONTONIC/ktime_get_ts, but also includes the time spent in suspend.

Definition at line 1199 of file timekeeping.c.

struct timespec get_monotonic_coarse ( void  )
read

Definition at line 1283 of file timekeeping.c.

unsigned long get_seconds ( void  )

Definition at line 1252 of file timekeeping.c.

void get_xtime_and_monotonic_and_sleep_offset ( struct timespec xtim,
struct timespec wtom,
struct timespec sleep 
)

get_xtime_and_monotonic_and_sleep_offset() - get xtime, wall_to_monotonic, and sleep offsets. : pointer to timespec to be set with xtime : pointer to timespec to be set with wall_to_monotonic : pointer to timespec to be set with time in suspend

Definition at line 1320 of file timekeeping.c.

void getboottime ( struct timespec ts)

getboottime - Return the real time of system boot. : pointer to the timespec to be set

Returns the wall-time of boot in a timespec.

This is based on the wall_to_monotonic offset and the total suspend time. Calls to settimeofday will affect the value returned (which basically means that however wrong your real time clock is at boot time, you get the right time here).

Definition at line 1176 of file timekeeping.c.

void getnstimeofday ( struct timespec ts)

getnstimeofday - Returns the time of day in a timespec : pointer to the timespec to be set

Returns the time of day in a timespec.

Definition at line 228 of file timekeeping.c.

void getrawmonotonic ( struct timespec ts)

getrawmonotonic - Returns the raw monotonic time in a timespec : pointer to the timespec to be set

Returns the raw monotonic time (completely un-modified by ntp)

Definition at line 503 of file timekeeping.c.

ktime_t ktime_get ( void  )

Definition at line 249 of file timekeeping.c.

ktime_t ktime_get_boottime ( void  )

ktime_get_boottime - Returns monotonic time since boot in a ktime

Returns the monotonic time since boot in a ktime

This is similar to CLOCK_MONTONIC/ktime_get, but also includes the time spent in suspend.

Definition at line 1231 of file timekeeping.c.

ktime_t ktime_get_monotonic_offset ( void  )

ktime_get_monotonic_offset() - get wall_to_monotonic in ktime_t format

Definition at line 1369 of file timekeeping.c.

ktime_t ktime_get_real ( void  )

ktime_get_real - get the real (wall-) time in ktime_t format

returns the time in ktime_t format

Definition at line 487 of file timekeeping.c.

void ktime_get_ts ( struct timespec ts)

ktime_get_ts - get the monotonic clock in timespec format : pointer to timespec variable

The function calculates the monotonic clock from the realtime clock and the wall_to_monotonic offset and stores the result in normalized timespec format in the variable pointed to by .

Definition at line 279 of file timekeeping.c.

void monotonic_to_bootbased ( struct timespec ts)

monotonic_to_bootbased - Convert the monotonic time to boot based. : pointer to the timespec to be converted

Definition at line 1244 of file timekeeping.c.

void __init timekeeping_init ( void  )

Definition at line 591 of file timekeeping.c.

int timekeeping_inject_offset ( struct timespec ts)

timekeeping_inject_offset - Adds or subtracts from the current time. : pointer to the timespec variable containing the offset

Adds or subtracts an offset value from the current time.

Definition at line 400 of file timekeeping.c.

void timekeeping_inject_sleeptime ( struct timespec delta)

timekeeping_inject_sleeptime - Adds suspend interval to timeekeeping values : pointer to a timespec delta value

This hook is for architectures that cannot support read_persistent_clock because their RTC/persistent clock is only accessible when irqs are enabled.

This function should only be called by rtc_resume(), and allows a suspend offset to be injected into the timekeeping values.

Definition at line 673 of file timekeeping.c.

u64 timekeeping_max_deferment ( void  )

timekeeping_max_deferment - Returns max time the clocksource can be deferred

Definition at line 542 of file timekeeping.c.

void timekeeping_notify ( struct clocksource clock)

timekeeping_notify - Install a new clock source : pointer to the clock source

This function is called from clocksource.c after a new, better clock source has been registered. The caller holds the clocksource_mutex.

Definition at line 472 of file timekeeping.c.

int timekeeping_valid_for_hres ( void  )

timekeeping_valid_for_hres - Check if timekeeping is suitable for hres

Definition at line 523 of file timekeeping.c.

void xtime_update ( unsigned long  ticks)

xtime_update() - advances the timekeeping infrastructure : number of ticks, that have elapsed since the last call.

Must be called with interrupts disabled.

Definition at line 1390 of file timekeeping.c.

Variable Documentation

int __read_mostly timekeeping_suspended

Definition at line 35 of file timekeeping.c.