diff options
Diffstat (limited to 'storage/storage.go')
| -rw-r--r-- | storage/storage.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/storage/storage.go b/storage/storage.go index 6455876..18a968d 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -36,7 +36,7 @@ func InitDb(path string) (*Database, error) { func (db *Database) AddMessage(msg core.Message) (err error) { _, err = db.Exec( "INSERT INTO messages (source, target, timestamp, content) VALUES (?, ?, ?, ?);", - msg.Source, msg.Target, msg.Timestamp.Unix(), msg.Content, + msg.Source, msg.Target, msg.Timestamp.UnixMilli(), msg.Content, ) return err @@ -84,7 +84,7 @@ func (db *Database) getHistory(rows *sql.Rows, err error) ([]core.Message, error if err = rows.Scan(&msg.Source, &msg.Target, ×tamp, &msg.Content); err != nil { return history, err } - msg.Timestamp = time.Unix(timestamp, 0) + msg.Timestamp = time.UnixMilli(timestamp) history = append(history, msg) } |
