Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicolasbauw/world-time-api
An API to retrieve date / time / daylight saving time informations about a timezone.
https://github.com/nicolasbauw/world-time-api
api docker dockerfile rust time timezone world
Last synced: about 8 hours ago
JSON representation
An API to retrieve date / time / daylight saving time informations about a timezone.
- Host: GitHub
- URL: https://github.com/nicolasbauw/world-time-api
- Owner: nicolasbauw
- License: mit
- Created: 2019-09-07T13:33:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T12:19:00.000Z (10 months ago)
- Last Synced: 2025-02-04T06:17:06.956Z (2 days ago)
- Topics: api, docker, dockerfile, rust, time, timezone, world
- Language: Rust
- Homepage:
- Size: 124 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# World Time API
[![Current Crates.io Version](https://img.shields.io/crates/v/world-time-api.svg)](https://crates.io/crates/world-time-api)
[![Downloads badge](https://img.shields.io/crates/d/world-time-api.svg)](https://crates.io/crates/world-time-api)An API to retrieve date / time / daylight saving time informations about a timezone.
Example:
```
curl http://localhost:8000/zoneinfo/Europe/Paris
{"abbreviation":"CEST","datetime":"2019-10-08T20:16:13.612030900+02:00","dst_from":"2019-03-31T01:00:00Z","dst_offset":7200,"dst_period":true,"dst_until":"2019-10-27T01:00:00Z","raw_offset":3600,"timezone":"Europe/Paris","utc_datetime":"2019-10-08T18:16:13.612030900Z","utc_offset":"+02:00","week":40}
```It uses system TZfiles (default location on Linux and Macos /usr/share/zoneinfo).
You can override the TZfiles default location with the TZFILES_DIR environment variable (ending by a /).
That also works on Windows, for example:```
$env:TZFILES_DIR="C:\Users\nbauw\Dev\rs-tzfile\zoneinfo\"; cargo run
```Some explanations about the offset fields:
- raw_offset : the "normal" offset to utc, in seconds
- dst_offset : the offset to utc during daylight saving time, in seconds
- utc_offset : the current offset to utc, taking into account daylight saving time or not (according to dst_from and dst_until), in +/- HH:MMProvided dockerfile (which is no longer maintained) builds the app with statically compiled musl libc and then uses an alpine image to keep a low size.