# time.c File Reference

`#include <ubixos/types.h>`
`#include <ubixos/time.h>`
`#include <ubixos/vitals.h>`
`#include <lib/kprintf.h>`
`#include <assert.h>`

Include dependency graph for time.c:

Go to the source code of this file.

## Functions

int | gettimeofday (struct timeval *tp, struct timezone *tzp)
int | time_init ()
static int | timeCmosRead (int addr)
uInt32 | timeMake (struct timeStruct *time)

## Variables

static int | month [12]

## Function Documentation

int gettimeofday | ( | struct timeval * | tp,
|  | struct timezone * | tzp |
| ) |  |  |

Definition at line 110 of file time.c.

References timeval::tv_sec, and timeval::tv_usec.

int time_init | ( |  | ) |

Definition at line 56 of file time.c.

References BCD_TO_BIN, timeStruct::day, timeStruct::hour, kprintf(), timeStruct::min, timeStruct::mon, timeStruct::sec, systemVitals, timeCmosRead(), timeMake(), vitalsStruct::timeStart, and timeStruct::year.

Here is the call graph for this function:

static int timeCmosRead | ( | int | addr | ) | `[static]`

Definition at line 51 of file time.c.

References inportByte(), and outportByteP().

Referenced by time_init().

Here is the call graph for this function:

uInt32 timeMake | ( | struct timeStruct * | time | ) |

Definition at line 92 of file time.c.

References timeStruct::day, DAY, timeStruct::hour, HOUR, timeStruct::min, MINUTE, timeStruct::mon, month, timeStruct::sec, YEAR, and timeStruct::year.

Referenced by time_init().

## Variable Documentation

int month[12]`[static]`

Initial value:

     {
            0,
            DAY*(31),
            DAY*(31+29),
            DAY*(31+29+31),
            DAY*(31+29+31+30),
            DAY*(31+29+31+30+31),
            DAY*(31+29+31+30+31+30),
            DAY*(31+29+31+30+31+30+31),
            DAY*(31+29+31+30+31+30+31+31),
            DAY*(31+29+31+30+31+30+31+31+30),
            DAY*(31+29+31+30+31+30+31+31+30+31),
            DAY*(31+29+31+30+31+30+31+31+30+31+30)
    }

Definition at line 36 of file time.c.

Referenced by timeMake().