convertGameClock

Converts between the game’s representation of the clock and human-readable values.

Signatures

beacon.convertGameClock(secondsFromWorldStart);
beacon.convertGameClock(clockInfo);
beacon.convertGameClock(days, hours, minutes);

Parameters

secondsFromWorldStart

The total number of seconds since day 1 00:00. Returns an object with days, hours, and minutes.

clockInfo

An object with keys day, hours, and minutes. Returns the number of seconds since day 1 00:00.

days

The day number. The first day of a new save is 1, not 0.

hours

The hours on the clock, 0 to 23.

minutes

The minutes on the clock, 0 to 59.

Examples

Convert total seconds to object

const clock = beacon.convertGameClock(394896);
beacon.debugPrint(`Day ${clock.day} at ${clock.hours}:${clock.minutes}`);
// Outputs "Day 4 at 13:41"

Convert object to total seconds

const clock = {
  day: 4,
  hours: 13,
  minutes: 41,
};
const totalSeconds = beacon.convertGameClock(clock);
beacon.debugPrint(totalSeconds);
// Outputs "394896"

Convert clock values to total seconds

const totalSeconds = beacon.convertGameClock(4, 13, 41);
beacon.debugPrint(totalSeconds);
// Outputs "394896"