Chronos | Time Management Framework

Chronos: A robust Time Management library for Roblox Studio

Introduction

Hello all! I decided to release my own first open-source library.
I hope this library will be helpful for any devs, even just a little bit.

Overview

I created this library since when I first started developing, working with time was really frustrating and difficult, and now that I have better skills, I have decided to come up with Chronos, a time management library for Roblox Studio.
I made it to be modular, and feature-rich that utilizes Roblox’s DateTime constructor (which I highly recommend you use for newer projects).
Whether you are scheduling events, creating countdown timers, managing cooldowns, or simply formatting time displays, Chronos provides a clean, consistent API to handle most if not all of your timing needs.

Features

Chronos is organized into 6 interconnected modules, each handling a specific aspect of time management:

Chronos

The parent module of all the other modules, providing quick and common functions:

  • Grabs and imports all child modules for use
  • Many common functions like a ‘Yield’ function that has optional debugging built in it
  • Version info

Core

The foundation of Chronos, providing essential DateTime manipulation factors that other modules use:

  • Unix timestamp conversion (seconds and milliseconds)
  • DateTime creation and modifying
  • Time difference calculations
  • Quick Date formatting

Timer

Create countdown and countup timers with event callbacks:

  • Progress tracking (numerical and percentage)
  • Pause, resume and reset functionality
  • Customizable display formatting
  • Completion callbacks

Cooldown

Very simple but useful cooldown management:

  • Track cooldown status and remaining time
  • Get progress as percentage
  • Reset cooldowns manually
  • Adjust durations on the fly

Scheduler

Schedule one-time and recurring events:

  • Precise timing control
  • Reschedule or cancel events
  • Monitor active scheduled events
  • Debug utilities for complex scheduling

Format

Format time values for display:

  • MM & HH:MM formatting
  • Human-readable formatting (“2 hours, 5 minutes”)
  • Compact formatting (2h 5m 10s)
  • DateTime range formatting

Performance Considerations

Chronos is designed with performance in mind, which uses efficient functions for time calculations and avoiding some unnecessary bloat-script.
Tips for taking performance into consideration:

  • Make sure to cache formatted time strings instead of regenerating them every frame or so
  • For UI updates, maybe consider reducing update frequency to about 0.1s intervals
  • Make sure to use the appropriate function based on what you need

Conclusion

Chronos is a library designed to make timing a bit easier for developers.
This is just a quick breakdown of what it includes, go check out the github for more details and examples plus how to actually import in your game: Github

Time management is a fundamental requirement in game design. Whether your making a round system, or combat system with cooldowns, your bound to run into handling time, and not everyone wants to play around with different time functions and data-types, when you could be doing other things.

Happy coding!

Note: This library is provided under the ‘MIT’ license. Feel free to use it in your own projects, commercial or otherwise.
3 Likes