writeEpoch method

void writeEpoch(
  1. num epoch, [
  2. encodeFloatAs floatType = encodeFloatAs.single
])
inherited

Tag based epoch encoding. Format can be a positive or negative integer or a floating point number for which you can chose the encoding.

Implementation

void writeEpoch(num epoch, [encodeFloatAs floatType = encodeFloatAs.single]) {
  _writeTag(tagDateTimeEpoch);
  if (epoch is int) {
    _writeInt(epoch);
  } else {
    if (floatType == encodeFloatAs.half) {
      _writeHalf(epoch.toDouble());
    } else if (floatType == encodeFloatAs.single) {
      _writeSingle(epoch.toDouble());
    } else {
      _writeDouble(epoch.toDouble());
    }
  }
  _builderHookImpl(false);
}