Files
discourse/migrations/lib/common/date_helper.rb
Gerhard Schlager 71a90dcba2 DEV: Refactor migrations-tooling
* Updates GitHub Action for migrations
* Rubocop: Always `EnforcedShorthandSyntax` for hashes in the `migrations` directory
* Automatically load all available converter steps
* Enable YJIT at runtime, if available
* Progressbar shows skipped records and other small improvements
2025-04-07 17:22:36 +02:00

18 lines
378 B
Ruby

# frozen_string_literal: true
module Migrations
module DateHelper
def self.human_readable_time(seconds)
hours, remainder = seconds.divmod(3600)
minutes, seconds = remainder.divmod(60)
format("%02d:%02d:%02d", hours, minutes, seconds)
end
def self.track_time
start_time = Time.now
yield
Time.now - start_time
end
end
end