package timeutils
import "github.com/docker/docker/pkg/timeutils"
Package timeutils provides helper functions to parse and print time (time.Time).
Index ¶
- Constants
- func FastMarshalJSON(t time.Time) (string, error)
- func GetTimestamp(value string, reference time.Time) string
Constants ¶
const ( // RFC3339NanoFixed is our own version of RFC339Nano because we want one // that pads the nano seconds part with zeros to ensure // the timestamps are aligned in the logs. RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00" // JSONFormat is the format used by FastMarshalJSON JSONFormat = `"` + time.RFC3339Nano + `"` )
Functions ¶
func FastMarshalJSON ¶
FastMarshalJSON avoids one of the extra allocations that time.MarshalJSON is making.
func GetTimestamp ¶
GetTimestamp tries to parse given string as golang duration, then RFC3339 time and finally as a Unix timestamp. If any of these were successful, it returns a Unix timestamp as string otherwise returns the given value back. In case of duration input, the returned timestamp is computed as the given reference time minus the amount of the duration.
Source Files ¶
- Version
- v1.9.0-rc5
- Published
- Nov 3, 2015
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 53 minutes ago –
Tools for package owners.