safeMillisecondsSinceEpoch property

int get safeMillisecondsSinceEpoch

Milliseconds since the Unix epoch, adjusted to avoid negative values.

If millisecondsSinceEpoch is negative (pre-1970 dates), 0x7fffffff is added to wrap it into a safe positive range. This allows representing dates before 1970 in systems that cannot handle negative timestamps.

Implementation

int get safeMillisecondsSinceEpoch {
  return millisecondsSinceEpoch < 0 ? millisecondsSinceEpoch + 0x7fffffff : millisecondsSinceEpoch;
}