github.com/ilhicas/nomad@v0.11.8/drivers/mock/utils.go (about)

     1  package mock
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  // parseDuration parses a duration string, like time.ParseDuration
     8  // but is empty string friendly, returns a zero time duration
     9  func parseDuration(s string) (time.Duration, error) {
    10  	if s == "" {
    11  		return time.Duration(0), nil
    12  	}
    13  
    14  	// try to parse it as duration
    15  	return time.ParseDuration(s)
    16  }