MentOS  0.8.0
The Mentoring Operating System
Functions | Variables
time.c File Reference

Clock functions. More...

Functions

 _syscall1 (time_t, time, time_t *, t)
 Time function.
 
static int day_of_week (unsigned int y, unsigned int m, unsigned int d)
 Computes day of week. More...
 
tm_tlocaltime (const time_t *time)
 The current time broken down into a tm_t structure. More...
 
size_t strftime (char *str, size_t maxsize, const char *format, const tm_t *timeptr)
 Formats the time tm according to the format specification format and places the result in the character array s of size max. More...
 
 _syscall2 (int, nanosleep, const struct timespec *, req, struct timespec *, rem)
 nanosleep function.
 

Variables

static const char * weekdays []
 List of week days name. More...
 
static const char * months []
 List of months name. More...
 

Detailed Description

Clock functions.

Function Documentation

◆ day_of_week()

static int day_of_week ( unsigned int  y,
unsigned int  m,
unsigned int  d 
)
inlinestatic

Computes day of week.

Parameters
yYear
mMonth of year (in range 1 to 12)
dDay of month (in range 1 to 31)
Returns
Day of week (in range 1 to 7)

◆ localtime()

tm_t* localtime ( const time_t timep)

The current time broken down into a tm_t structure.

Parameters
timepA pointer to a variable holding the current time.
Returns
The time broken down.

◆ strftime()

size_t strftime ( char *  s,
size_t  max,
const char *  format,
const tm_t tm 
)

Formats the time tm according to the format specification format and places the result in the character array s of size max.

Parameters
sThe destination buffer.
maxThe maximum length of the buffer.
formatThe buffer used to generate the time.
tmThe broken-down time.
Returns
The number of bytes (excluding the terminating null) placed in s.

Variable Documentation

◆ months

const char* months[]
static
Initial value:
= {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
}

List of months name.

◆ weekdays

const char* weekdays[]
static
Initial value:
= {
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
}

List of week days name.