getCachedTimestamp static method

String getCachedTimestamp()

获取格式化后的时间戳(带缓存)

Returns a cached timestamp updated every 100 milliseconds.

Implementation

static String getCachedTimestamp() {
  final now = DateTime.now().millisecondsSinceEpoch;
  if (now - _lastTimestampUpdate > 100) {
    // 每 100 毫秒更新一次
    _cachedTimestamp = getFormattedTimestamp();
    _lastTimestampUpdate = now;
  }
  return _cachedTimestamp;
}