我对“事件时间戳”AVP 有一个问题。
我知道我应该把纪元时间放在那里,但我主要关心它的格式,这是我到目前为止在 RFC 中找到的:
8.21. Event-Timestamp AVP
The Event-Timestamp (AVP Code 55) is of type Time, and MAY be
included in an Accounting-Request and Accounting-Answer messages to
record the time that the reported event occurred, in seconds since
January 1, 1900 00:00 UTC.
Time
The Time format is derived from the OctetString AVP Base Format.
The string MUST contain four octets, in the same format as the
first four bytes are in the NTP timestamp format. The NTP
Timestamp format is defined in chapter 3 of [SNTP].
This represents the number of seconds since 0h on 1 January 1900
with respect to the Coordinated Universal Time (UTC).
On 6h 28m 16s UTC, 7 February 2036 the time value will overflow.
SNTP [SNTP] describes a procedure to extend the time to 2104.
This procedure MUST be supported by all DIAMETER nodes.
那么,问题是我应该先获取系统当前时间(以纪元格式),然后将其转换为字符串并直接将其传递给 Event-Timestamp 吗?
但标准说:“ The string MUST contain four octets
”。
我不知道如何实现这一点......你能详细说明一下吗?