Skip to content

urjitbhatia/gohumantime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gohumantime

A human readable time translator in golang

GoDoc

Motivation

Use a simple human readable string representation of time Inspired by: https://github.com/rschmukler/human-interval

Usage:

import "github.com/urjitbhatia/gohumantime"
//...
millis, err := gohumantime.ToMilliseconds("1 day and 14 hours")

millis, err := gohumantime.ToMilliseconds("9981234314")
// If string is numeric, unit is assumed to be Milliseconds and a simple atoi conversion is returned.
//...

Benchmarks

  //3000 samples of ToMilliseconds("4 seconds, 2 minutes 1 hour and 3 days and 10weeks, 1 month and 1 year"):

  Ran 3000 samples:
  runtime:
    Fastest Time: 0.000s
    Slowest Time: 0.001s
    Average Time: 0.000s ± 0.000s

About

A human readable time translator in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages