Fix #500. Support `y` suffix in query time durations
parent
29c55c1854
commit
d0269a3516
|
@ -2,6 +2,7 @@
|
|||
|
||||
### Bugfixes
|
||||
|
||||
- [Issue #500](https://github.com/influxdb/influxdb/issues/500). Support `y` sufix in time durations
|
||||
- [Issue #501](https://github.com/influxdb/influxdb/issues/501). Writes with invalid payload should be rejected
|
||||
|
||||
## v0.6.0 [2014-05-02]
|
||||
|
|
|
@ -37,6 +37,8 @@ func ParseTimeDuration(value string) (int64, error) {
|
|||
return int64(parsedFloat * 24 * float64(time.Hour)), nil
|
||||
case 'w':
|
||||
return int64(parsedFloat * 7 * 24 * float64(time.Hour)), nil
|
||||
case 'y':
|
||||
return int64(parsedFloat * 365 * 24 * float64(time.Hour)), nil
|
||||
}
|
||||
|
||||
lastChar := value[len(value)-1]
|
||||
|
|
|
@ -2,9 +2,9 @@ package parser
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
. "launchpad.net/gocheck"
|
||||
"testing"
|
||||
"time"
|
||||
. "launchpad.net/gocheck"
|
||||
)
|
||||
|
||||
// Hook up gocheck into the gotest runner.
|
||||
|
@ -419,6 +419,7 @@ func (self *QueryParserSuite) TestTimeWithNegativeEndTime(c *C) {
|
|||
func (self *QueryParserSuite) TestParseSelectWithTimeCondition(c *C) {
|
||||
queries := map[string]time.Time{
|
||||
"select value, time from t where time > now() - 1d and time < now() - 1m;": time.Now().Add(-time.Minute).Round(time.Minute).UTC(),
|
||||
"select value, time from t where time > now() - 1d and time < now() - 1y;": time.Now().Add(-365 * 24 * time.Hour).Round(time.Minute).UTC(),
|
||||
"select value, time from t where time > now() - 1d and time < now();": time.Now().Round(time.Minute).UTC(),
|
||||
}
|
||||
for query, expected := range queries {
|
||||
|
|
Loading…
Reference in New Issue