Sha256: f474df8c1e50d5cd98b94ada7c8e52d7b3a3fe4c77a1a426b69b28981041fe4d

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

module Poms
  # Functionality for manipulating Poms timestamps
  module Timestamp
    module_function

    # Convert unix timestamp in milliseconds to datetime
    def to_datetime(timestamp)
      return unless timestamp

      Time.at(timestamp / 1000).to_datetime
    end

    # Convert to unix timestamp in milliseconds
    def to_unix_ms(datetime)
      return unless datetime

      datetime.to_i * 1000
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
poms-3.0.0 lib/poms/timestamp.rb