Issue
I was testing a feature where I had to write a record with created_at
field which is of type time.Time
into a Mysql table. When I read the same record back I get following diff.
Time: (time.Time) {
- wall: (uint64) 454722000,
+ wall: (uint64) 0,
What is wall
in golang Time
and why are they different?
Solution
The real reason for me has to do with nano seconds
. Apparently when I write to db nano seconds
are stripped off. So what I did is created a function that would return me current time but without nano seconds
.
Answered By – Asur
Answer Checked By – Dawn Plyler (GoLangFix Volunteer)