formatTime formats t for a SAML message. saml-core §1.3.3 says SAML time values "MUST be expressed in UTC form, with no time zone component", so t is converted to UTC first; a time in another zone would otherwise keep its offset. Fractions finer than a millisecond are dropped.
(t time.Time)
| 13 | // is converted to UTC first; a time in another zone would otherwise keep |
| 14 | // its offset. Fractions finer than a millisecond are dropped. |
| 15 | func formatTime(t time.Time) string { |
| 16 | return t.UTC().Format(timeFormat) |
| 17 | } |
| 18 | |
| 19 | // optionalRelaxedTime returns t as a *RelaxedTime, or nil if t is the zero |
| 20 | // time. It is used for optional time attributes, so that MarshalXML leaves |