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:
|
||||
raise newException(ValueError, "Invalid time passed to this thing")
|
||||
|
||||
return res[].fromSeconds.timeToTimeInfo
|
||||
let
|
||||
resdep = res[]
|
||||
restime = resdep.fromSeconds
|
||||
|
||||
return restime.timeToTimeInfo
|
||||
|
||||
when isMainModule:
|
||||
let myTime = fixTime("2006-01-02T15:04:05.000000-07:00")
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
import "time"
|
||||
|
||||
import "C"
|
||||
|
||||
|
|
|
@ -74,5 +74,7 @@ proc updateTweetsOnce*() {. gcsafe .} =
|
|||
for tweet in tweets.items():
|
||||
try:
|
||||
db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds().int(), tweet.message)
|
||||
except: discard
|
||||
except: discard
|
||||
except:
|
||||
echo getCurrentExceptionMsg()
|
||||
except:
|
||||
echo getCurrentExceptionMsg()
|
||||
|
|
Loading…
Reference in New Issue