mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 23:51:03 +00:00
adjusted set bit timestamp format
This commit is contained in:
parent
ef298b2c79
commit
83685c4e8c
2 changed files with 21 additions and 11 deletions
|
|
@ -323,17 +323,23 @@ type JsonObject map[string]interface{}
|
|||
//
|
||||
func bitmaps(frame string, obj JsonObject) chan uint64 {
|
||||
c := make(chan uint64)
|
||||
const shortForm = "2006-01-02 15:04:01"
|
||||
|
||||
go func() {
|
||||
const shortFormT = "2006-01-02T15:04:05"
|
||||
const shortFormS = "2006-01-02 15:04:05"
|
||||
t := float64(obj["bitmap_id"].(float64))
|
||||
base_id := uint64(t)
|
||||
|
||||
if strings.HasSuffix(frame, ".t") {
|
||||
timestamp := obj["timestamp"].(string)
|
||||
shortForm := shortFormS
|
||||
if strings.Contains(timestamp, "T") {
|
||||
shortForm = shortFormT
|
||||
}
|
||||
atime, _ := time.Parse(shortForm, timestamp)
|
||||
|
||||
for _, id := range index.GetTimeIds(base_id, atime, index.YMDH) {
|
||||
log.Println(id)
|
||||
c <- id
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -21,20 +21,24 @@ func getTime(id uint64, s string) {
|
|||
}
|
||||
func TestDemo(t *testing.T) {
|
||||
Convey("Test ID", t, func() {
|
||||
getTime(uint64(666), "2014-01-01 00:00")
|
||||
getTime(uint64(666), "2014-02-01 00:00")
|
||||
getTime(uint64(666), "2014-03-01 00:00")
|
||||
getTime(uint64(666), "2014-04-01 00:00")
|
||||
getTime(uint64(666), "2014-04-02 00:00")
|
||||
getTime(uint64(666), "2014-04-03 00:00")
|
||||
getTime(uint64(666), "2014-04-04 00:00")
|
||||
getTime(uint64(666), "2014-04-05 00:00")
|
||||
getTime(uint64(666), "2014-05-01 00:00")
|
||||
getTime(uint64(666), "2014-06-01 00:00")
|
||||
getTime(uint64(1), "2014-08-11 14:00")
|
||||
So(1, ShouldEqual, 1)
|
||||
})
|
||||
}
|
||||
func TestTimeFrame(t *testing.T) {
|
||||
Convey("Test 1H", t, func() {
|
||||
const shortForm = "2006-01-02 15:04"
|
||||
t1, _ := time.Parse(shortForm, "2014-08-11 14:00")
|
||||
t2, _ := time.Parse(shortForm, "2014-08-11 16:00")
|
||||
m := GetRange(t1, t2, uint64(1))
|
||||
getTime(uint64(1), "2014-08-11 14:00")
|
||||
spew.Dump(m)
|
||||
|
||||
So(len(m), ShouldEqual, 1)
|
||||
})
|
||||
if true {
|
||||
return
|
||||
}
|
||||
|
||||
//print get_YMD_id(2014,3,28,1234)
|
||||
Convey("Test ID", t, func() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue