Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Better use of UTC-based timing #8

Description

@rickb777

This is based on source code inspection of logging/logging.go.

Lines 59-61 get the time in the local timezone.

start := al.clock()
al.handler.ServeHTTP(wrapper, r)
end := al.clock()

Line 87 does a conversion to UTC

start.In(time.UTC).Format(apacheFormat),

and line 95 is

end.Sub(start).Nanoseconds()/int64(time.Millisecond)

There is a rare problem that the duration calculation will be in error when daylight saving turns on or off, for locales that have it. A simple solution might be to change lines 59 and 61

start := al.clock().UTC()
al.handler.ServeHTTP(wrapper, r)
end := al.clock().UTC()

and simplify line 87

start.Format(apacheFormat),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions