Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the type of seconds since midnight #854

Merged
merged 3 commits into from
Jun 28, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions vic/drivers/shared_all/src/vic_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ get_current_datetime(char *cdt)
{
char ymd[MAXSTRING];
struct tm *timeinfo;
unsigned int seconds_since_midnight;
unsigned long long seconds_since_midnight;
time_t curr_date_time;

curr_date_time = time(NULL);
Expand All @@ -62,13 +62,13 @@ get_current_datetime(char *cdt)

timeinfo = localtime(&curr_date_time);

seconds_since_midnight = (unsigned int) curr_date_time % CONST_CDAY;
seconds_since_midnight = (unsigned long long) curr_date_time % CONST_CDAY;

if (strftime(ymd, MAXSTRING - 1, "%Y%m%d", timeinfo) == 0) {
log_err("Something went wrong converting the current time info to ymd");
}

sprintf(cdt, "%s-%05d", ymd, seconds_since_midnight);
snprintf(cdt, MAXSTRING, "%s-%05d", ymd, seconds_since_midnight);
}

/******************************************************************************
Expand Down