Skip to content

Commit 68f7fc8

Browse files
Fix last_enqueued_time_utc on Linux and other platforms that can represent 1-1-0001 as a SystemTime (but not as an OffsetDateTime). (#2180)
* Fixed #2128 * Removed traces
1 parent b6a1e49 commit 68f7fc8

File tree

1 file changed

+7
-0
lines changed
  • sdk/core/azure_core_amqp/src/fe2o3

1 file changed

+7
-0
lines changed

sdk/core/azure_core_amqp/src/fe2o3/value.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ const CE_ZERO_MILLISECONDS: i64 = -62_135_596_800_000;
4141

4242
impl From<fe2o3_amqp_types::primitives::Timestamp> for AmqpTimestamp {
4343
fn from(timestamp: fe2o3_amqp_types::primitives::Timestamp) -> Self {
44+
// The AMQP timestamp is the number of milliseconds since the Unix epoch.
45+
// AMQP brokers represent the lowest value as -62_135_596_800_000 (the
46+
// number of milliseconds between the Unix epoch (1/1/1970) and year 1 CE) as
47+
// a sentinel for a time which is not set.
48+
if (timestamp.milliseconds() as u64) == CE_ZERO_MILLISECONDS as u64 {
49+
return AmqpTimestamp(None);
50+
}
4451
AmqpTimestamp(
4552
std::time::UNIX_EPOCH.checked_add(std::time::Duration::from_millis(
4653
timestamp.milliseconds() as u64,

0 commit comments

Comments
 (0)