forked from mtusi2026/mtusi2026lab2
init(app) moved app code from Lab1
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RFCFormTime time.Time
|
||||
|
||||
func (t RFCFormTime) MarshalJSON() ([]byte, error) {
|
||||
ftime := time.Time(t).UTC().Format(time.RFC3339)
|
||||
return json.Marshal(ftime)
|
||||
}
|
||||
|
||||
func NowUTC() RFCFormTime {
|
||||
return RFCFormTime(time.Now().UTC().Truncate(time.Second))
|
||||
}
|
||||
Reference in New Issue
Block a user