Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Q quickfix
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 48
    • Issues 48
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 25
    • Merge requests 25
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • quickfixgo
  • quickfix
  • Merge requests
  • !205

fixes another same range bug

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/cbusbey/session_time into master 8 years ago
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: cbusbey

Refs #31 (closed)

Compare
  • master (base)

and
  • latest version
    3c03b46f
    1 commit, 2 years ago

2 files
+ 10
- 1

    Preferences

    File browser
    Compare changes
inte‎rnal‎
time_r‎ange.go‎ +1 -1
time_rang‎e_test.go‎ +9 -0
internal/time_range.go
+ 1
- 1
  • View file @ 3c03b46f

  • Edit in single-file editor

  • Open in Web IDE


@@ -73,7 +73,7 @@ func (r *TimeRange) IsInSameRange(t1, t2 time.Time) bool {
t1UTC := t1.UTC()
t1Time := NewTimeOfDay(t1UTC.Clock())
sessionEnd := time.Date(t1UTC.Year(), t1UTC.Month(), t1UTC.Day(), r.EndTime.hour, r.EndTime.minute, r.EndTime.second, 0, time.UTC)
if r.StartTime.duration() >= r.EndTime.duration() && t1Time.duration() > r.StartTime.duration() {
if r.StartTime.duration() >= r.EndTime.duration() && t1Time.duration() >= r.StartTime.duration() {
sessionEnd = sessionEnd.AddDate(0, 0, 1)
}
internal/time_range_test.go
+ 9
- 0
  • View file @ 3c03b46f

  • Edit in single-file editor

  • Open in Web IDE


@@ -143,6 +143,7 @@ func TestTimeRangeIsInSameRange(t *testing.T) {
loc, err := time.LoadLocation("America/Chicago")
require.Nil(t, err)
time1 = time.Date(2016, time.August, 10, 20, 53, 47, 397094815, loc)
time2 = time.Date(2016, time.August, 10, 20, 53, 47, 397094992, loc)
start = NewTimeOfDay(0, 53, 47)
@@ -150,6 +151,14 @@ func TestTimeRangeIsInSameRange(t *testing.T) {
assert.True(t, (&TimeRange{start, end}).IsInSameRange(time1, time2))
assert.True(t, (&TimeRange{start, end}).IsInSameRange(time2, time1))
start = NewTimeOfDay(23, 31, 0)
end = NewTimeOfDay(0, 31, 0)
time1 = time.Date(2016, time.August, 10, 18, 31, 0, 88414271, loc)
time2 = time.Date(2016, time.August, 10, 18, 31, 0, 88416914, loc)
assert.True(t, (&TimeRange{start, end}).IsInSameRange(time1, time2))
assert.True(t, (&TimeRange{start, end}).IsInSameRange(time2, time1))
var tr *TimeRange
assert.True(t, tr.IsInSameRange(time1, time2), "always in same range if time range is nil")
}
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
Bug
1
Bug
    Assign labels
  • Manage project labels

Milestone
v0.5.0
v0.5.0
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: quickfixgo/quickfix!205
Source branch: github/fork/cbusbey/session_time

Menu

Explore Projects Groups Snippets