- const unsigned int whole_seconds = abs((int) t);
- const unsigned int days = whole_seconds / (60 * 60 * 24);
- const unsigned int hours = (whole_seconds / (60 * 60)) % 24;
- const unsigned int minutes = (whole_seconds / 60) % 60;
- const unsigned int seconds = whole_seconds % 60;
+ const Timestamp whole_seconds = floor(abs(t));
+ const Timestamp days = floor(whole_seconds / (60 * 60 * 24));
+ const unsigned int hours = fmod(whole_seconds / (60 * 60), 24).convert_to<uint>();
+ const unsigned int minutes = fmod(whole_seconds / 60, 60).convert_to<uint>();
+ const unsigned int seconds = fmod(whole_seconds, 60).convert_to<uint>();