WTIME
WTIME provides a variety of functions for obtaining the current UTC and local times, as well as generating customizable timestamps to suit your needs.
Table of Contents
Installation
Run the following Cargo command in your project directory:
cargo add wtime
Or add wtime to your Cargo.toml file:
[]
= "MAJOR.MINOR.PATCH" # Replace with the latest version
Changelog
Features
-
Current Time Retrieval
- UTC and Local Time: WTIME offers seamless access to both current UTC and local times, making it easy to work with time zones and coordinate time-related functionalities.
-
Customizable Timestamps
- Flexible Formatting: Generate timestamps in various formats to meet your specific requirements, whether for logging, database entries, or user interfaces.
- Configuration Options: Tailor timestamp outputs to include or exclude specific components (e.g., date, time, time zone) based on your project needs.
-
Time Zone Support
- Multiple Time Zones: Easily convert between different time zones, allowing for applications that require global time management.
- Daylight Saving Time Adjustments: Automatic adjustments for daylight saving time ensure that your applications reflect accurate local time.
-
Easy Integration
- User-Friendly API: The WTIME API is designed with simplicity in mind, allowing developers to implement time-related functions with minimal effort.
- Comprehensive Documentation: Well-documented functions and examples help users quickly understand how to leverage the crate effectively.
-
High Performance
- Efficiency: WTIME is optimized for performance, ensuring that time retrieval and manipulation operations are fast and resource-friendly.
- Lightweight: The crate is designed to be lightweight, minimizing overhead while providing extensive functionality.
-
Unique ID (UID) Generation
- Timestamp-Based UIDs: Generate unique identifiers derived from either the current UTC (uid_utc) or local server time (uid_local).
- Alphanumeric Obfuscation: Digits within the timestamp are transformed into letters using a shifting alphabetical mapping, allowing for non-numeric, human-readable IDs.
- Flexible Formatting: Control the output format by choosing whether to include hyphens as separators or generate a compact, continuous string of letters.
- Configurable Indexing: Customize the alphabetical shift using an index parameter, providing control over the generated letter sequence while maintaining a time-based ID structure.
Usage
1. CALC
use ;
use get_day;
2. LOCAL
use ;
use utc_ts_nanos;
3. TZ
use ;
4. UTC
use ;
5. UID
use ;
Documentation
CALC
| Function | Function | Function |
|---|---|---|
| calc_date | calc_week | duration_since |
| get_day_name | get_millis | get_minute |
| get_month_name | get_nanos | get_second |
| - | is_leap_year | - |
LOCAL
| Function | Function | Function |
|---|---|---|
| format_local_ts | get_local_day | get_local_hour |
| get_local_month | get_local_year | local_now |
| local_ts_millis | local_ts_nanos | local_ts_sec |
TZ
| Function | Function |
|---|---|
| tz_number | tz_string |
UTC
| Function | Function | Function |
|---|---|---|
| format_utc_ts | get_day | get_hour |
| get_month | get_year | utc_now |
| utc_ts_millis | utc_ts_nanos | utc_ts_sec |
UID
| Function | Function |
|---|---|
| uid_utc | uid_local |
License
This project is licensed under either of the following licenses:
- MIT License
- Apache License, Version 2.0
You may choose either license for your purposes.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any feature requests or bug reports.