fix a bug in time parsing
This commit is contained in:
parent
47ace0e4c4
commit
87f1cfe1b1
|
@ -10,7 +10,11 @@ proc parseTime*(inp: string): TimeInfo =
|
||||||
if res == nil:
|
if res == nil:
|
||||||
raise newException(ValueError, "Invalid time passed to this thing")
|
raise newException(ValueError, "Invalid time passed to this thing")
|
||||||
|
|
||||||
return res[].fromSeconds.timeToTimeInfo
|
let
|
||||||
|
resdep = res[]
|
||||||
|
restime = resdep.fromSeconds
|
||||||
|
|
||||||
|
return restime.timeToTimeInfo
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
let myTime = fixTime("2006-01-02T15:04:05.000000-07:00")
|
let myTime = fixTime("2006-01-02T15:04:05.000000-07:00")
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import "time"
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
|
|
@ -74,5 +74,7 @@ proc updateTweetsOnce*() {. gcsafe .} =
|
||||||
for tweet in tweets.items():
|
for tweet in tweets.items():
|
||||||
try:
|
try:
|
||||||
db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds().int(), tweet.message)
|
db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds().int(), tweet.message)
|
||||||
except: discard
|
except:
|
||||||
except: discard
|
echo getCurrentExceptionMsg()
|
||||||
|
except:
|
||||||
|
echo getCurrentExceptionMsg()
|
||||||
|
|
Loading…
Reference in New Issue