package open import ( "context" timeapi "service.xpcool.com/api/open/v1/tools/time" "service.xpcool.com/common/tools/timex" ) // Time returns the current server timestamp and formatted time. func (c *Controller) Time(ctx context.Context, req *timeapi.TimeReq) (res *timeapi.TimeRes, err error) { now := timex.Now() return &timeapi.TimeRes{ Timestamp: now.Timestamp(), DateTime: now.Layout(timex.LayoutDateTime), Date: now.Layout(timex.LayoutDate), }, nil }