-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The timestamp will change after calling the carbon.CreateFromTimestampUTC()
method
#48
Comments
It seems that Maybe below is a correct implementation: filename: carbon.go
// SetTimestamp sets the current time given a timestamp
func (c *Carbon) SetTimestamp(sec int64) {
- t := time.Unix(sec, 0)
+ t := time.Unix(sec, 0).In(c.Location())
c.Time = time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), c.Location())
} @BigKuCha
|
I've created a test case for this #50, but it seems to pass. Do you see anything wrong? |
@hfcorreia the result is as same as before. it will pass if i set my local timezone to UTC+0, so i guess that your local timezone is UTC+0. The function,
after i did this no matter what my system timezone is, the test will never fail.
|
Why are
unix
andutcTime.Unix()
not equal?I got
1543837131
1543865931
The text was updated successfully, but these errors were encountered: