time

Sintaxis

#include <time.h>

time_t time(time_t *t);

Descripción

Si t no es NULL, el tiempo actual se almacena en *t.

Valor devuelto

Devuelve el tiempo actual en segundos calculados desde el 1/1/1970.

Portabilidad

ANSI, POSIX

Ejemplo

En la función main se muestra el tiempo actual en segundos.

#include <stdio.h>
#include <time.h>
int main(){
   printf("El tiempo actual en segundos es %ld\n", time(0));
   return 0;
}