10 #include "simpletools.h" 15 datetime dt = {2015, 10, 21, 11, 49, 56};
24 print(
"\nmss = %d\n\n", mss);
25 print(
"\nmss = %d\n\n", mms);
26 print(
"\nmss = %d\n\n", msms);
29 print(
"date/time strings = ");
36 print(
"date/time strings = ");
42 datetime dt2 = {2000, 1, 2, 3, 4, 5};
45 strcpy(s,
"08/03/13");
47 print(
"fromTimeStr\n");
48 print(
"dt2.y = %d, dt2.mo = %d, dt2.d = %d, dt2.h = %d, dt2.m = %d, dt2.s = %d\n\n",
49 dt2.
y, dt2.
mo, dt2.
d, dt2.
h, dt2.
m, dt2.
s);
56 print(
"dt.y = %d, dt.mo = %d, dt.d = %d, dt.h = %d, dt.m = %d, dt.s = %d\n",
57 dt.
y, dt.
mo, dt.
d, dt.
h, dt.
m, dt.
s);
void dt_toTimeStr(datetime dt, char *s)
Populates a string (minimum 9 characters) with the hh:mm:ss representation of a datetime type's time...
datetime dt_get()
Get the current system time. To find the current system time (as a datetime type), call this function. Note: This assumes that a call to dt_run has been made. This is common near the beginning of a program that uses the system timekeeping.
void dt_run(datetime dt)
Run a date/time second counting process in another cog. Example: datetime dts = {2015, 9, 25, 8, 11, 04}; dt_run(dts);.
datetime dt_fromDateStr(datetime dt, char *s)
Populates the y, mo, and d fields in a datetime type with value representations of the characters in ...
int dt_getms()
Get the number of ms into the current second from the system time second. Notes: This assumes that a ...
< datetime_st Structure containing y, mo, h, m, and s elements.
This library provides convenient functions for a variety of timekeeping operations. This library makes use of a manual Spin to C translation of functions from Bob Belleville's date_time_epoch.spin for converting to/from between epoch time (seconds from midnight, 1/1/1970) and a datetime format.
void dt_toDateStr(datetime dt, char *s)
Populates a string (minimum 9 characters) with the mm/dd/yy representation of a datetime type's date...
datetime dt_fromTimeStr(datetime dt, char *s)
Populates the time fields (h, m, and s) in a datetime type with value representations of the characte...
void dt_set(datetime dt)
Set the system date and time. This can be used to change the system's current date/time. Example datetime mydt={2015, 9, 25, 8, 13, 51}; dt_set(mydt); You can also use this to change the datetime type that was used in dt_start to "set" the second counter that auto-increments.