Changeset 784 in code for trunk/downstream.go


Ignore:
Timestamp:
Feb 16, 2022, 1:45:09 PM (3 years ago)
Author:
contact
Message:

Introduce formatServerTime

It's too easy to forget to convert to UTC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r783 r784  
    23312331
    23322332                                broadcastTags := tags.Copy()
    2333                                 broadcastTags["time"] = irc.TagValue(time.Now().UTC().Format(serverTimeLayout))
     2333                                broadcastTags["time"] = irc.TagValue(formatServerTime(time.Now()))
    23342334                                broadcastMsg := &irc.Message{
    23352335                                        Tags:    broadcastTags,
     
    23572357                                if dc.caps["echo-message"] {
    23582358                                        echoTags := tags.Copy()
    2359                                         echoTags["time"] = irc.TagValue(time.Now().UTC().Format(serverTimeLayout))
     2359                                        echoTags["time"] = irc.TagValue(formatServerTime(time.Now()))
    23602360                                        dc.SendMessage(&irc.Message{
    23612361                                                Tags:    echoTags,
     
    23892389
    23902390                        echoTags := tags.Copy()
    2391                         echoTags["time"] = irc.TagValue(time.Now().UTC().Format(serverTimeLayout))
     2391                        echoTags["time"] = irc.TagValue(formatServerTime(time.Now()))
    23922392                        if uc.account != "" {
    23932393                                echoTags["account"] = irc.TagValue(uc.account)
     
    24402440
    24412441                        echoTags := tags.Copy()
    2442                         echoTags["time"] = irc.TagValue(time.Now().UTC().Format(serverTimeLayout))
     2442                        echoTags["time"] = irc.TagValue(formatServerTime(time.Now()))
    24432443                        if uc.account != "" {
    24442444                                echoTags["account"] = irc.TagValue(uc.account)
     
    27372737                                                Prefix:  dc.srv.prefix(),
    27382738                                                Command: "CHATHISTORY",
    2739                                                 Params:  []string{"TARGETS", target.Name, target.LatestMessage.UTC().Format(serverTimeLayout)},
     2739                                                Params:  []string{"TARGETS", target.Name, formatServerTime(target.LatestMessage)},
    27402740                                        })
    27412741                                }
     
    28332833                timestampStr := "*"
    28342834                if !r.Timestamp.IsZero() {
    2835                         timestampStr = fmt.Sprintf("timestamp=%s", r.Timestamp.UTC().Format(serverTimeLayout))
     2835                        timestampStr = fmt.Sprintf("timestamp=%s", formatServerTime(r.Timestamp))
    28362836                }
    28372837                uc.forEachDownstream(func(d *downstreamConn) {
Note: See TracChangeset for help on using the changeset viewer.