GitXplorerGitXplorer
u

gohumantime

public
4 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
eb30da7fa31b7e6afebeedde6c9f2885f6a7b22d

Support shortcircuit if supplied string is already ms numeric

uurjitbhatia committed 7 years ago
Unverified
d9f838252691f5db27df4973a78a81aa1e0aa6d6

Add some more test cases

uurjitbhatia committed 8 years ago
Unverified
0a66fead78c534cb63ff023c0f75de13cadd69f4

recognize now and improve perf by caching mapping

uurjitbhatia committed 9 years ago
Unverified
a814787f724c50a780030c09dfa9fcfc06dce4bd

Better documentation

uurjitbhatia committed 9 years ago
Unverified
0fa31a150e38ba29af0fb4a104874657eee35747

Update README.md

uurjitbhatia committed 9 years ago
Unverified
447068fa53de45cadb403dadb31b5b3439167bbd

add more number word literals

uurjitbhatia committed 9 years ago

README

The README file for this repository.

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