Time.h

Time.h

time.h

time.h es un archivo de cabecera de la biblioteca estándar del lenguaje de programación C que contiene funciones para manipular y formatear la fecha y hora del sistema.

Contenido

Funciones

Nombre Descripción
char * asctime(struct tm *) Recibe una variable de tipo puntero a estructura tm (struct tm*) y devuelve una cadena de caracteres cuyo formato es:
"Www Mmm dd hh:mm:ss yyyy" (ej: Tue May 15 19:07:04 2008)
clock_t clock (void) Devuelve el número de pulsos de reloj desde que se inició el proceso
char * ctime(time t *) Recibe una variable de tipo puntero a time t (time t*) y devuelve una cadena con el mismo formato que asctime()
double difftime(time t, time t) Recibe dos variables de tipo time t, calcula su diferencia y devuelve el resultado (double) expresado en segundos.
struct tm *gmtime(time t *) Recibe un puntero a una variable de tiempo (time t*) y devuelve su conversion como fecha/hora UTC a struct tm a través de un puntero.
struct tm *localtime(time t *) Similar funcionalidad a gmtime(), pero devuelve la conversión como fecha/hora LOCAL.
time t mktime(struct tm *) Inversamente a gmtime() y localtime(),l recibe un puntero a struct tm (struct tm*) y devuelve su conversión al tipo time t.
time t time(time t *) Devuelve la fecha/hora (time t) actual o -1 en caso de no ser posible. Si el argumento que se le pasa no es NULL, también asigna la fecha/hora actual a dicho argumento.
size_t strftime(char *,size_t,char *,struct tm *) Formatea la información pasada mediante la estructura (struct tm*) mediante el formato indicado en una cadena (char*) e imprime el resultado sobre otra cadena (char*) hasta un límite de caracteres (size_t).

Constantes

Nombre Descripción
CLK_PER_SEC Constante que define el número de pulsos de reloj por segundo; usado por la función clock()
CLOCKS_PER_SEC nombre alternativo para CLK_PER_SEC usado en su lugar en algunas bibliotecas
CLK_TCK usualmente una macro para CLK_PER_SEC

Tipos de datos

Nombre Descripción
clock_t tipo de dato devuelto por clock(), generalmente un long int
time t tipo de dato devuelto por time(), generalmente un long int
struct tm representación del tiempo en formato de calendario (fecha/hora)

Fecha (día/hora) de calendario

La fecha de calendario se representa como la estructura struct tm, que consta de los siguientes atributos:

Atributo Descripción
int tm_hour hora (0 - 23)
int tm_isdst Horario de verano enabled/disabled
int tm_mday día del mes (1 - 31)
int tm_min minutos (0 - 59)
int tm_mon mes (0 - 11, 0 = Enero)
int tm_sec segundos (0 - 60)
int tm_wday día de la semana (0 - 6, 0 = domingo)
int tm_yday día del año (0 - 365)
int tm_year año desde 1900

Véase también

Referencias

Obtenido de "Time.h"

Wikimedia foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Mira otros diccionarios:

  • Time — Time, n.; pl. {Times}. [OE. time, AS. t[=i]ma, akin to t[=i]d time, and to Icel. t[=i]mi, Dan. time an hour, Sw. timme. [root]58. See {Tide}, n.] 1. Duration, considered independently of any system of measurement or any employment of terms which… …   The Collaborative International Dictionary of English

  • Time UK — is a computer retailer set up by the people behind the failed Time Computer Systems.The company is based within the main factory offices at Time Technology Park in Simonstone, near Burnley in Lancashire. The company specializes in providing… …   Wikipedia

  • Time — (t[imac]m), v. t. [imp. & p. p. {Timed} (t[imac]md); p. pr. & vb. n. {Timing}.] 1. To appoint the time for; to bring, begin, or perform at the proper season or time; as, he timed his appearance rightly. [1913 Webster] There is no greater wisdom… …   The Collaborative International Dictionary of English

  • Time — Time, v. i. 1. To keep or beat time; to proceed or move in time. [1913 Webster] With oar strokes timing to their song. Whittier. [1913 Webster] 2. To pass time; to delay. [Obs.] [1913 Webster] …   The Collaborative International Dictionary of English

  • Time — This article is about the measurement. For the magazine, see Time (magazine). For other uses, see Time (disambiguation). The flow of sand in an hourglass can be used to keep track of elapsed time. It also concretely represents the present as… …   Wikipedia

  • time — See: ABOUT TIME, AGAINST TIME, AT A TIME, AT ONE TIME, AT THE SAME TIME, AT TIMES, BEHIND THE TIMES, BEHIND TIME, BIDE ONE S TIME, BIG TIME, EVERY TIME ONE TURNS AROUND, FOR THE TIME BEING, FROM TIME TO TIME, GIVE A HARD TIME, HAVE A TIME, HIGH… …   Dictionary of American idioms

  • time — See: ABOUT TIME, AGAINST TIME, AT A TIME, AT ONE TIME, AT THE SAME TIME, AT TIMES, BEHIND THE TIMES, BEHIND TIME, BIDE ONE S TIME, BIG TIME, EVERY TIME ONE TURNS AROUND, FOR THE TIME BEING, FROM TIME TO TIME, GIVE A HARD TIME, HAVE A TIME, HIGH… …   Dictionary of American idioms

  • time — I. noun Etymology: Middle English, from Old English tīma; akin to Old Norse tīmi time, Old English tīd more at tide Date: before 12th century 1. a. the measured or measurable period during which an action, process, or condition exists or… …   New Collegiate Dictionary

  • Time t — The time t datatype is a data type in the ISO C library defined for storing system time values. Such values are returned from the standard time() library function. This type is a typedef defined in the standard lt;time.h gt; header. ISO C defines …   Wikipedia

  • Time³ — Infobox Album | Name = Time3 Type = Compilation album Artist = Journey Released = December 1, 1992 Recorded = May 1976 Aug 1985 Genre = Rock Length = Disc 1: 73:39 Disc 2: 76:31 Disc 3: 78:21 Label = Columbia Producer = Don DeVito Reviews = *… …   Wikipedia

  • Time ball — Time Time, n.; pl. {Times}. [OE. time, AS. t[=i]ma, akin to t[=i]d time, and to Icel. t[=i]mi, Dan. time an hour, Sw. timme. [root]58. See {Tide}, n.] 1. Duration, considered independently of any system of measurement or any employment of terms… …   The Collaborative International Dictionary of English

Compartir el artículo y extractos

Link directo
… Do a right-click on the link above
and select “Copy Link”