19 lines
320 B
C
19 lines
320 B
C
|
/*
|
||
|
* Copyright 2015 (c) Anna Schumaker.
|
||
|
*/
|
||
|
#include <core/date.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
|
||
|
void date_today(struct date *date)
|
||
|
{
|
||
|
time_t rawtime = time(NULL);
|
||
|
struct tm *now = localtime(&rawtime);
|
||
|
|
||
|
if (date) {
|
||
|
date->d_year = now->tm_year + 1900;
|
||
|
date->d_month = now->tm_mon + 1;
|
||
|
date->d_day = now->tm_mday;
|
||
|
}
|
||
|
}
|