
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
better-clock-time
Advanced tools
Better Clock Time is a lightweight, intuitive TypeScript library designed to simplify working with clock-style durations. It offers a clean and expressive API for creating, manipulating, and formatting time represented in milliseconds. Whether you're dealing with milliseconds, seconds, minutes, or hours, Better Clock Time makes it easy to construct and adjust time values with chainable methods like .extend() and .consume().
With convenient accessors for hours, minutes, and seconds, as well as custom string formatting and conversion utilities, this library is ideal for applications involving timers, countdowns, scheduling, and more—without the overhead of a full date-time solution.
import { ClockTime } from 'better-clock-time'
// Create a ClockTime instance with 12345 milliseconds
ClockTime.of(12345)
// By default, the time is set to 0 milliseconds
ClockTime.of()
// Create a ClockTime instance with 100 seconds
ClockTime.ofSeconds(100)
// Create a ClockTime instance with 80 minutes
ClockTime.ofMinutes(80)
// Create a ClockTime instance with 5 hours
ClockTime.ofHours(5)
import { ClockTime } from 'better-clock-time'
// It represents 01:15:32
const clockTime = ClockTime.of(4532500)
// Print the milliseconds, which should be 4532500
console.log(clockTime.ms)
// Print the second, which should be 32
console.log(clockTime.second)
// Print the minute, which should be 15
console.log(clockTime.minute) // 15
// Print the hour, which should be 1
console.log(clockTime.hour) // 1
Consuming time reduces a ClockTime instance's internal time by the given time.
import { ClockTime } from 'better-clock-time'
const clockTime = ClockTime.of()
// Extend 500 milliseconds
clockTime.extend(500)
// Extend 20 seconds
clockTime.extendSecond(20)
// Extend 5 minutes
clockTime.extendMinute(5)
// Extend 1 hour
clockTime.extendHour(1)
// You can pass another ClockTimeInstance
clockTime.extend(ClockTime.of(35000))
// Supports chaining programming
clockTime.extendHour(1).extendMinute(5).extendSecond(20)
Extending time increases a ClockTime instance's internal time by the given time.
import { ClockTime } from 'better-clock-time'
const clockTime = ClockTime.of(10000000)
// Consume 500 milliseconds
clockTime.consume(500)
// Consume 20 seconds
clockTime.consumeSecond(20)
// Consume 5 minutes
clockTime.consumeMinute(5)
// Consume 1 hour
clockTime.consumeHour(1)
// You can pass another ClockTimeInstance
clockTime.consume(ClockTime.of(35000))
// Supports chaining programming
clockTime.consumeHour(1).consumeMinute(5).consumeSecond(20)
import { ClockTime } from 'better-clock-time'
const clockTime = ClockTime.of(500)
const clonedClockTime = time.clone()
clockTime.extend(500)
// The `clonedClockTime` is not affected and thus the ms is still 500
console.log(clonedClockTime.ms)
import { ClockTime } from 'better-clock-time'
// This ClockTime instance represents 1:15:32
const clockTime = new SlowHourMinuteSecond(4532500)
// The toString() method is overried; this will output `01:15:32`
console.log(clockTime)
// You can specify the format of the string
// The following will output `01-15-32`
console.log(clockTime.toString('hh-mm-ss'))
import { ClockTime } from 'better-clock-time'
const clockTIme = ClockTIme.of(75048245)
// 75048.245
console.log(time.toSeconds())
// 1250.8040833333334
console.log(time.toMinutes())
// 20.846734722222223
console.log(time.toHours())
import { ClockTime } from 'better-clock-time'
const clockTIme = ClockTIme.of(75048245)
// 75048
console.log(time.toSecondsInt()) // >> 75048
// 1250
console.log(time.toMinutesInt())
// 20
console.log(time.toHoursInt())
FAQs
A simple clock time library.
The npm package better-clock-time receives a total of 5 weekly downloads. As such, better-clock-time popularity was classified as not popular.
We found that better-clock-time demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.