Diferencia entre revisiones de «time t»

De ArduWiki
Saltar a: navegación, buscar
(Página creada con «== Descripcion == '''time_t''' es un tipo unsigned long usado para almacenar los segundos transcurridos desde el 1-ENE-1970 o también llamada fecha Unix. == Sintaxis...»)
 
(Ejemplos)
Línea 11: Línea 11:
 
== Advertencias ==
 
== Advertencias ==
  
== Ejemplos ==
+
== Ejemplo 1 ==
 +
<syntaxhighlight lang="c++">
 +
void setup(){
 +
  setTime(10,0,0,14,7,2018);  //h,min,seg,dia,mes,año
 +
}
 +
void loop(){
 +
}
 +
</syntaxhighlight>
 +
 
 +
== Ejemplo 2 ==
 
Si usas la libreria RTClib.h tendras disponible la clase [[DateTime]].
 
Si usas la libreria RTClib.h tendras disponible la clase [[DateTime]].
  
<pre>
+
<syntaxhighlight lang="c++">
 
DateTime hoy = rtc.noy();
 
DateTime hoy = rtc.noy();
 
time_t unix = hoy.unixtime();
 
time_t unix = hoy.unixtime();
</pre>
+
</syntaxhighlight>
  
 
== Vea tambien ==
 
== Vea tambien ==

Revisión del 19:19 11 jul 2018

Descripcion

time_t es un tipo unsigned long usado para almacenar los segundos transcurridos desde el 1-ENE-1970 o también llamada fecha Unix.

Sintaxis

time_t variable [= valor];

Parametros

Advertencias

Ejemplo 1

void setup(){
   setTime(10,0,0,14,7,2018);  //h,min,seg,dia,mes,año
}
void loop(){
}

Ejemplo 2

Si usas la libreria RTClib.h tendras disponible la clase DateTime.

DateTime hoy = rtc.noy();
time_t unix = hoy.unixtime();

Vea tambien

Referencias