TacOS  0.2
 Tout Structures de données Fichiers Fonctions Variables Définitions de type Énumérations Macros
Macros | Fonctions | Variables
Référence du fichier clock.c

Gestion de l'horloge et du temps en général. Plus de détails...

#include <types.h>
#include <ioports.h>
#include <i8254.h>
#include <clock.h>
#include <interrupts.h>
#include <kstdio.h>
#include <klibc/limits.h>
#include "heap.h"
Graphe des dépendances par inclusion de clock.c:

Macros

#define RTC_REQUEST   0x70
 
#define RTC_ANSWER   0x71
 
#define RTC_SECOND   0x00
 
#define RTC_SECOND_ALARM   0x01
 
#define RTC_MINUTE   0x02
 
#define RTC_MINUTE_ALARM   0x03
 
#define RTC_HOUR   0x04
 
#define RTC_HOUR_ALARM   0x05
 
#define RTC_DAY_OF_WEEK   0x06
 
#define RTC_DATE_OF_MONTH   0x07
 
#define RTC_MONTH   0x08
 
#define RTC_YEAR   0x09
 
#define LEAPYEAR(year)   (!((year) % 4) && (((year) % 100) || !((year) % 400)))
 
#define YEARSIZE(year)   (LEAPYEAR(year) ? 366 : 365)
 
#define YEAR0   1900
 
#define EPOCH_YR   1970
 
#define SECS_DAY   (24L * 60L * 60L)
 
#define TIME_MAX   0xFFFFFFFFL
 

Fonctions

void clock_tick ()
 Incrémente le temps système. Ajoute une milliseconde au temps système, ne met rien à jour au dela du jour actuel.
 
uint8_t bcd2binary (uint8_t n)
 
time_t clock_mktime (struct tm *timep)
 Conversion struct tm vers time_t. Conversion d'une date exprimée sous la forme secondes, minutes, heures, jour, mois, année, etc, vers le format time_t. Plus de détails...
 
void clock_init ()
 Initialisation de l'horloge. Initialisation de l'horloge.
 
clock_t get_clock ()
 Retourne le temps système. Renvoie la valeur actuelle du temps système en nombre de ticks (1 tick = 1ms).
 
 SYSCALL_HANDLER1 (sys_getclock, clock_t *clock)
 Syscall handler pour get_clock. Syscall handler pour get_clock. Plus de détails...
 
time_t get_date ()
 Retourne la date actuelle en secondes. Retourne la date actuelle en secondes. Plus de détails...
 
 SYSCALL_HANDLER1 (sys_getdate, time_t *date)
 Syscall handler pour get_date. Syscall handler pour get_date. Plus de détails...
 
struct timeval get_tv ()
 Retourne date courante. Retourne une structure timeval qui contient la date courante en seconde et microsecondes. Plus de détails...
 
int compare_times (struct timeval a, struct timeval b)
 Comparaison de 2 temps. Comparaison de 2 temps. Plus de détails...
 
void timeval_add_usec (struct timeval *t, time_t usec)
 Ajoute des us à un temps. Ajoute des us à un temps contenu dans une structure timeval. Plus de détails...
 
void klog_systime ()
 

Variables

time_t boot_systime
 
const int _ytab [2][12]
 

Description détaillée

Auteur
TacOS developers

LICENSE

Copyright (C) 2010-2014 TacOS developers.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org/copyleft/gpl.html

You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses.

DESCRIPTION

Documentation des macros

#define EPOCH_YR   1970

Constante pour convertir les années exprimées depuis 1970.

#define LEAPYEAR (   year)    (!((year) % 4) && (((year) % 100) || !((year) % 400)))

Macro function pour déterminer si une année est bissextile.

#define RTC_ANSWER   0x71

RTC read/write port

#define RTC_DATE_OF_MONTH   0x07

select day of month

#define RTC_DAY_OF_WEEK   0x06

select day of week

#define RTC_HOUR   0x04

select hours

#define RTC_HOUR_ALARM   0x05

select hours alarm

#define RTC_MINUTE   0x02

select minutes

#define RTC_MINUTE_ALARM   0x03

select minutes alarm

#define RTC_MONTH   0x08

select month

#define RTC_REQUEST   0x70

RTC select port

#define RTC_SECOND   0x00

select seconds

#define RTC_SECOND_ALARM   0x01

select seconds alarm

#define RTC_YEAR   0x09

select year

#define SECS_DAY   (24L * 60L * 60L)

Nombre de secondes dans un jour.

#define TIME_MAX   0xFFFFFFFFL

Temps maximum.

#define YEAR0   1900

Constante pour convertir les années exprimées depuis 1900

#define YEARSIZE (   year)    (LEAPYEAR(year) ? 366 : 365)

Nombre de jour dans une année.

Documentation des fonctions

time_t clock_mktime ( struct tm timep)
Renvoie
Le temps correspondant.

Voici le graphe des appelants de cette fonction :

int compare_times ( struct timeval  a,
struct timeval  b 
)
Renvoie
-1, 1 ou 0 en fonction du résultat.
time_t get_date ( )
inline
Renvoie
la date en secondes.

Voici le graphe des appelants de cette fonction :

struct timeval get_tv ( )
Renvoie
une structure timeval.

Voici le graphe d'appel pour cette fonction :

Voici le graphe des appelants de cette fonction :

SYSCALL_HANDLER1 ( sys_getclock  ,
clock_t clock 
)
Paramètres
clockUn pointeur pour y stocker la valeur de l'horloge système.

Voici le graphe d'appel pour cette fonction :

SYSCALL_HANDLER1 ( sys_getdate  ,
time_t date 
)
Paramètres
dateUn pointeur pour y stocker la date.

Voici le graphe d'appel pour cette fonction :

void timeval_add_usec ( struct timeval t,
time_t  usec 
)
Paramètres
tLa structure qui contient un temps.
usecLe nombre de us à ajouter.

Voici le graphe des appelants de cette fonction :

Documentation des variables

const int _ytab[2][12]
Valeur initiale :
= { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }}