diff options
Diffstat (limited to 'time.go')
| -rw-r--r-- | time.go | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -74,7 +74,7 @@ func (f *FlagSet) GetTime(name string) (time.Time, error) { // TimeVar defines a time.Time flag with specified name, default value, and usage string. // The argument p points to a time.Time variable in which to store the value of the flag. func (f *FlagSet) TimeVar(p *time.Time, name string, value time.Time, formats []string, usage string) { - f.VarP(newTimeValue(value, p, formats), name, "", usage) + f.TimeVarP(p, name, "", value, formats, usage) } // TimeVarP is like TimeVar, but accepts a shorthand letter that can be used after a single dash. @@ -85,7 +85,7 @@ func (f *FlagSet) TimeVarP(p *time.Time, name, shorthand string, value time.Time // TimeVar defines a time.Time flag with specified name, default value, and usage string. // The argument p points to a time.Time variable in which to store the value of the flag. func TimeVar(p *time.Time, name string, value time.Time, formats []string, usage string) { - CommandLine.VarP(newTimeValue(value, p, formats), name, "", usage) + CommandLine.TimeVarP(p, name, "", value, formats, usage) } // TimeVarP is like TimeVar, but accepts a shorthand letter that can be used after a single dash. @@ -96,9 +96,7 @@ func TimeVarP(p *time.Time, name, shorthand string, value time.Time, formats []s // Time defines a time.Time flag with specified name, default value, and usage string. // The return value is the address of a time.Time variable that stores the value of the flag. func (f *FlagSet) Time(name string, value time.Time, formats []string, usage string) *time.Time { - p := new(time.Time) - f.TimeVarP(p, name, "", value, formats, usage) - return p + return f.TimeP(name, "", value, formats, usage) } // TimeP is like Time, but accepts a shorthand letter that can be used after a single dash. |
