Returns a time format for the given precision
(precision time.Duration)
| 49 | |
| 50 | // Returns a time format for the given precision |
| 51 | func formatForPrecision(precision time.Duration) string { |
| 52 | switch { |
| 53 | case precision <= time.Nanosecond: |
| 54 | return "2006-01-02T15:04:05.000000000Z07:00" |
| 55 | case precision <= 10*time.Nanosecond: |
| 56 | return "2006-01-02T15:04:05.00000000Z07:00" |
| 57 | case precision <= 100*time.Nanosecond: |
| 58 | return "2006-01-02T15:04:05.0000000Z07:00" |
| 59 | case precision <= time.Microsecond: |
| 60 | return "2006-01-02T15:04:05.000000Z07:00" |
| 61 | case precision <= 10*time.Microsecond: |
| 62 | return "2006-01-02T15:04:05.00000Z07:00" |
| 63 | case precision <= 100*time.Microsecond: |
| 64 | return "2006-01-02T15:04:05.0000Z07:00" |
| 65 | case precision <= time.Millisecond: |
| 66 | return "2006-01-02T15:04:05.000Z07:00" |
| 67 | case precision <= 10*time.Millisecond: |
| 68 | return "2006-01-02T15:04:05.00Z07:00" |
| 69 | case precision <= 100*time.Millisecond: |
| 70 | return "2006-01-02T15:04:05.0Z07:00" |
| 71 | } |
| 72 | return time.RFC3339 |
| 73 | } |
| 74 | |
| 75 | // ListJSONOpt describes the options for ListJSON |
| 76 | type ListJSONOpt struct { |
no outgoing calls
no test coverage detected
searching dependent graphs…