|
AquilaOS documentation
How it works, and its code
|
The wall clock: the date and time of day. More...
Go to the source code of this file.
Functions | |
| int | gettime (struct timespec *ts) |
| Reads the wall clock (CLOCK_REALTIME). | |
| void | time_resync (void) |
| Sets the wall clock from the real time clock again, if they are 2 seconds or more apart. | |
| int | gettimeofday (struct timeval *tv, struct timezone *tz) |
| Reads the wall clock, in microseconds, for gettimeofday(). | |
Variables | |
| static time_t | clock_base_sec |
| static uint64_t | clock_base_ns |
| static int | clock_set |
The wall clock: the date and time of day.
The real time clock (the CMOS clock on the PC) only counts seconds, so it is read once, and from then on the wall clock follows the kernel's monotonic clock (arch_rtime_ns()), which counts much finer. time_resync() sets it from the real time clock again now and then, in case the two drift apart.
Definition in file time.c.
| int gettime | ( | struct timespec * | ts | ) |
Reads the wall clock (CLOCK_REALTIME).
The first call reads the real time clock.
| ts | set to the time, since the epoch |
Definition at line 29 of file time.c.
References arch_rtime_ns(), arch_time_get(), clock_base_ns, clock_base_sec, clock_set, gettime(), timespec::tv_nsec, and timespec::tv_sec.
Referenced by cpio_root_node(), devfs_init(), devpts_init(), ext2_inode_discard(), ext2_vlink(), ext2_vmknod(), ext2_vrename(), ext2_vunlink(), gettime(), gettimeofday(), procfs_init(), procfs_vget(), pseudofs_vmknod(), sys_clock_gettime(), time_resync(), tmpfs_mount(), vfs_chmod(), vfs_chown(), and vfs_utimens().
Reads the wall clock, in microseconds, for gettimeofday().
| tv | if not NULL, set to the time, since the epoch |
| tz | if not NULL, set to UTC (the kernel has no time zones) |
Definition at line 78 of file time.c.
References gettime(), gettimeofday(), timespec::tv_nsec, timespec::tv_sec, timeval::tv_sec, timeval::tv_usec, timezone::tz_dsttime, and timezone::tz_minuteswest.
Referenced by gettimeofday(), and sys_gettimeofday().
| void time_resync | ( | void | ) |
Sets the wall clock from the real time clock again, if they are 2 seconds or more apart.
The tick calls it now and then: the monotonic clock, which the wall clock follows, may count a little fast or slow.
Definition at line 54 of file time.c.
References arch_rtime_ns(), arch_time_get(), clock_base_ns, clock_base_sec, clock_set, gettime(), printk(), time_resync(), and timespec::tv_sec.
Referenced by sched_tick(), time_resync(), and x86_sched_handler().
|
static |
Definition at line 19 of file time.c.
Referenced by gettime(), and time_resync().
|
static |
Definition at line 18 of file time.c.
Referenced by gettime(), and time_resync().
|
static |
Definition at line 20 of file time.c.
Referenced by gettime(), and time_resync().