Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

time_craft

time_craft is a Rust library designed for manipulating times without dealing with dates. Whether you need to add or subtract minutes, handle hour and minute rollovers, or compare different times, time_craft makes it easy.

Features

  • Time Manipulation: Add or subtract minutes from a given time.
  • Rollover Support: Automatically adjusts hours and minutes when values exceed their limits.
  • Equality Comparison: Compare two clock instances to check if they represent the same time.
  • String Formatting: Provides a user-friendly string representation of the time.

Installation

Add time_craft to your Cargo.toml:

[dependencies]
time_craft = "0.1.0"

Then, run cargo build to download and compile the library.

Usage

Here’s a simple example of how to use the time_craft library:

use time_craft::Clock;

fn main() {
    let clock = Clock::new(10, 0);
    let updated_clock = clock.add_minutes(125);
    println!("{}", updated_clock); // Outputs "12:05"
}

Running Tests

The project includes a comprehensive set of tests. You can run them with the following command:

cargo test

About

A Rust library for manipulating clock times without dates. Includes support for adding and subtracting minutes, rolling over hours and minutes, and comparing clock instances for equality.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages