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

Conversation

quasi-mod
Copy link
Contributor

  • closes #xxx
  • tests passed
  • new tests added
  • science test figures
  • ran uncrustify prior to final commit
  • ReleaseNotes entry

This PR changes the type of seconds_since_midnight and the explicit cast of curr_date_time. the previous implementation casted curr_date_time, which is a time_t value (64bit value), to unsigned int and took the mod. However, casting 64bit value to 32bit value (uint) will result in loosing upper 32 bits, and thus will result in the value wrapping around (btw, the exact year time_t value will wrap around in unsigned int is year 2106).
To prevent this, curr_date_time should be casted to u64 type.

Thanks in advance for your consideration.

@jhamman
Copy link
Member

jhamman commented Dec 6, 2018

Thank you for your contribution. This all looks fine to me. @tbohn / @yixinmao / @bartnijssen - care to take a peak?

Copy link
Member

@bartnijssen bartnijssen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use snprintf() rather than sprintf() in vic_log.c anyway.

@bartnijssen bartnijssen merged commit 2363827 into UW-Hydro:develop Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants