FreeBSD kernel kern code
subr_clock.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/limits.h>
#include <sys/sysctl.h>
#include <sys/timetc.h>
Include dependency graph for subr_clock.c:

Go to the source code of this file.

Macros

#define FEBRUARY   2
 
#define days_in_year(y)   (leapyear(y) ? 366 : 365)
 
#define days_in_month(y, m)   (month_days[(m) - 1] + (m == FEBRUARY ? leapyear(y) : 0))
 
#define day_of_week(days)   (((days) + 4) % 7)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static int sysctl_machdep_adjkerntz (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_machdep, OID_AUTO, adjkerntz, CTLTYPE_INT|CTLFLAG_RW,&adjkerntz, 0, sysctl_machdep_adjkerntz,"I","Local offset from UTC in seconds")
 
 SYSCTL_INT (_debug, OID_AUTO, clocktime, CTLFLAG_RW,&ct_debug, 0,"Enable printing of clocktime debugging")
 
 SYSCTL_INT (_machdep, OID_AUTO, wall_cmos_clock, CTLFLAG_RW,&wall_cmos_clock, 0,"Enables application of machdep.adjkerntz")
 
static int leapyear (int year)
 
static void print_ct (struct clocktime *ct)
 
int clock_ct_to_ts (struct clocktime *ct, struct timespec *ts)
 
void clock_ts_to_ct (struct timespec *ts, struct clocktime *ct)
 
int utc_offset (void)
 

Variables

int tz_minuteswest
 
int tz_dsttime
 
static int adjkerntz
 
static int ct_debug
 
static int wall_cmos_clock
 
static const int month_days [12]
 

Macro Definition Documentation

#define day_of_week (   days)    (((days) + 4) % 7)

Definition at line 94 of file subr_clock.c.

Referenced by clock_ts_to_ct().

#define days_in_month (   y,
 
)    (month_days[(m) - 1] + (m == FEBRUARY ? leapyear(y) : 0))

Definition at line 91 of file subr_clock.c.

Referenced by clock_ct_to_ts(), and clock_ts_to_ct().

#define days_in_year (   y)    (leapyear(y) ? 366 : 365)

Definition at line 90 of file subr_clock.c.

Referenced by clock_ct_to_ts(), and clock_ts_to_ct().

#define FEBRUARY   2

Definition at line 89 of file subr_clock.c.

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
int clock_ct_to_ts ( struct clocktime *  ct,
struct timespec *  ts 
)

Definition at line 134 of file subr_clock.c.

References ct_debug, days, days_in_month, days_in_year, print_ct(), and printf().

Here is the call graph for this function:

void clock_ts_to_ct ( struct timespec *  ts,
struct clocktime *  ct 
)

Definition at line 181 of file subr_clock.c.

References ct_debug, day_of_week, days, days_in_month, days_in_year, print_ct(), and printf().

Here is the call graph for this function:

static int leapyear ( int  year)
static

Definition at line 110 of file subr_clock.c.

static void print_ct ( struct clocktime *  ct)
static

Definition at line 126 of file subr_clock.c.

References printf().

Referenced by clock_ct_to_ts(), and clock_ts_to_ct().

Here is the call graph for this function:

Here is the caller graph for this function:

SYSCTL_INT ( _debug  ,
OID_AUTO  ,
clocktime  ,
CTLFLAG_RW  ,
ct_debug,
,
"Enable printing of clocktime debugging"   
)
SYSCTL_INT ( _machdep  ,
OID_AUTO  ,
wall_cmos_clock  ,
CTLFLAG_RW  ,
wall_cmos_clock,
,
"Enables application of machdep.adjkerntz  
)
static int sysctl_machdep_adjkerntz ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 62 of file subr_clock.c.

References resettodr(), and sysctl_handle_int().

Here is the call graph for this function:

SYSCTL_PROC ( _machdep  ,
OID_AUTO  ,
adjkerntz  ,
CTLTYPE_INT|  CTLFLAG_RW,
adjkerntz,
,
sysctl_machdep_adjkerntz  ,
"I"  ,
"Local offset from UTC in seconds"   
)
int utc_offset ( void  )

Definition at line 222 of file subr_clock.c.

References adjkerntz, tz_minuteswest, and wall_cmos_clock.

Referenced by fattime2timespec(), inittodr(), resettodr(), and timespec2fattime().

Here is the caller graph for this function:

Variable Documentation

int adjkerntz
static

Definition at line 60 of file subr_clock.c.

Referenced by utc_offset().

int ct_debug
static

Definition at line 74 of file subr_clock.c.

Referenced by clock_ct_to_ts(), and clock_ts_to_ct().

const int month_days[12]
static
Initial value:
= {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
}

Definition at line 96 of file subr_clock.c.

int tz_dsttime

Definition at line 54 of file subr_clock.c.

Referenced by kern_settimeofday(), and sys_gettimeofday().

int tz_minuteswest

Definition at line 53 of file subr_clock.c.

Referenced by kern_settimeofday(), sys_gettimeofday(), and utc_offset().

int wall_cmos_clock
static

Definition at line 78 of file subr_clock.c.

Referenced by utc_offset().