Skip to content

Commit

Permalink
Fix SCTIME_ADD_SECS zeroing subsecond part
Browse files Browse the repository at this point in the history
When adding s seconds to SCtime_t ts, don't zero out the ts.usecs field.

Fixes Redmine Bug #6584
  • Loading branch information
sfd committed Nov 28, 2023
1 parent 9c3ab36 commit 5a3d9dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util-time.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ typedef struct {
#define SCTIME_USECS(t) ((uint64_t)(t).usecs)
#define SCTIME_SECS(t) ((uint64_t)(t).secs)
#define SCTIME_MSECS(t) (SCTIME_SECS(t) * 1000 + SCTIME_USECS(t) / 1000)
#define SCTIME_ADD_SECS(ts, s) SCTIME_FROM_SECS((ts).secs + (s))
#define SCTIME_ADD_SECS(ts, s) \
(SCTime_t) \
{ \
.secs = (ts)->secs + t, .usecs = (ts)->tv_usec \
}
#define SCTIME_ADD_USECS(ts, us) SCTIME_FROM_USECS((ts).usecs + (us))
#define SCTIME_FROM_SECS(s) \
(SCTime_t) \
Expand Down

0 comments on commit 5a3d9dd

Please sign in to comment.