|
TacOS
0.2
|
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"
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] |
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.
| #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.

|
inline |

| struct timeval get_tv | ( | ) |


| SYSCALL_HANDLER1 | ( | sys_getclock | , |
| clock_t * | clock | ||
| ) |
| clock | Un pointeur pour y stocker la valeur de l'horloge système. |

| SYSCALL_HANDLER1 | ( | sys_getdate | , |
| time_t * | date | ||
| ) |
| date | Un pointeur pour y stocker la date. |

| t | La structure qui contient un temps. |
| usec | Le nombre de us à ajouter. |

| const int _ytab[2][12] |
1.8.7