Skip to content
Open
Changes from all 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 Sources/Segment/Utilities/QueueTimer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ internal class QueueTimer {

extension TimeInterval {
static func milliseconds(_ value: Int) -> TimeInterval {
return TimeInterval(value / 1000)
return TimeInterval(value) / 1000
Copy link
Author

Choose a reason for hiding this comment

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

This calculation had an integer-division problem. My change makes it so that we're dividing Double types rather than Int types, and therefore are no longer truncating.

}

static func seconds(_ value: Int) -> TimeInterval {
return TimeInterval(value)
}

static func hours(_ value: Int) -> TimeInterval {
return TimeInterval(60 * value)
return TimeInterval(60 * 60 * value)
Copy link
Author

Choose a reason for hiding this comment

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

a TimeInterval represents a second. There are 60 seconds in a minute, and 60 seconds in an hour.

}

static func days(_ value: Int) -> TimeInterval {
return TimeInterval((60 * value) * 24)
return TimeInterval((60 * 60 * value) * 24)
Copy link
Author

Choose a reason for hiding this comment

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

Same as above.

}
}