Skip to content

An implementation of ISO8601 duration parsing and formatting using time.Duration as the underlying type

License

Notifications You must be signed in to change notification settings

SpirentOrion/iso8601duration.v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

iso8601duration

ISO8601 Duration Parser for Golang

Inspired by https://github.com/ChannelMeter/iso8601duration, which was in turn adapted from http://github.com/BrianHicks/finch.

The main difference between this package and ChannelMeter's is that this package does not define its own Duration type -- Golang's time.Duration is used instead. This choice was made from the perspective that time.Duration is often what you want anyway. A consequence is that you cannot "round-trip" from an ISO8601-formatted duration, through time.Duration, and back to ISO8601 with the guarantee that you'll get the same string. You should however be able to get an equivalent ISO8601 value.

Also, this package supports decimal fractions in the smallest time value, e.g. PT0.25M is 15 seconds, PT0.001S is 1 millisecond, etc.

About

An implementation of ISO8601 duration parsing and formatting using time.Duration as the underlying type

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages