Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Files

clk.h/clk.c

Prototype

Code Block
languagecpp
CPU_BOOLEAN  Clk_UnixDateTimeMake (CLK_DATE_TIME  *p_date_time,
                                   CLK_YR          yr,
                                   CLK_MONTH       month,
                                   CLK_DAY         day,
                                   CLK_HR          hr,
                                   CLK_MIN         min,
                                   CLK_SEC         sec,
                                   CLK_TZ_SEC      tz_sec);


Arguments

p_date_time

Pointer to variable that will receive the date/time structure.

...

Day of week (p_date_time->DayOfWk) and Day of year (p_date_time->DayOfYr) are internally calculated and set in the date/time structure.

Example Usage

Anchor
Listing - Clk_UnixDateTimeMake() Example Usage
Listing - Clk_UnixDateTimeMake() Example Usage

Code Block
languagecpp
titleListing - Clk_UnixDateTimeMake() Example Usage
linenumberstrue
CLK_DATE_TIME  date_time;
CPU_BOOLEAN    valid;
 
                                      /* 2010/09/18   11:11:11 UTC-05:00  */
valid = Clk_UnixDateTimeMake(&date_time, 2010, 9, 18, 11, 11, 11, -18000);
if (valid == DEF_OK) {
    printf("Date/time successfully created");
} else {
    printf("Clock Date/time error\n\r");
}