-
Notifications
You must be signed in to change notification settings - Fork 0
/
date.h
33 lines (27 loc) · 777 Bytes
/
date.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//************************************
//FUNCION: void Date(Hora , Fecha)
//PARAMETROS: Puntero de hora y fecha actual
//RETORNO: n/a
//DESCRIPCION: Actualiza por referencia la hora/fecha actual
//FUNCIONES INVOCADAS: n/a
//*************************************
void Date(char *t,char *d){
time_t tSac = time(NULL);// instante actual
struct tm* tmP = localtime(&tSac);
char min[3],sec[3];
char mon[3],day[3];
sprintf(t, "%d", tmP->tm_hour);
sprintf(min, "%d", tmP->tm_min);
sprintf(sec, "%d", tmP->tm_sec);
sprintf(d, "%d", tmP->tm_year+1900);
sprintf(mon, "%d", tmP->tm_mon+1);
sprintf(day, "%d", tmP->tm_mday);
strcat(t,":");
strcat(t,min);
strcat(t,":");
strcat(t,sec);
strcat(d,"/");
strcat(d,mon);
strcat(d,"/");
strcat(d,day);
}