Date Time Functions

Overview

The date/time module provides wrapper functions around the standard library time module.

Features

  • Get time with dt_today(), dt_now().

  • Get timestamps for logs with dt_timestamp_str().

  • Parse medium date string.

  • DAY, HOUR, MINUTE, WEEK defines.

Examples

#include <c-craft/dt.h>

time_t today = dt_today();
time_t now = dt_now();

time_t date = dt_parse_date("12-mar-16");

MEM_SCOPE mem = sm_create(0);
printf("The local time is %s\n", dt_timestamp_str(mem, now, FALSE));
sm_free(mem);