{"id":16962691,"url":"https://github.com/sgoudham/office-hours","last_synced_at":"2025-04-11T22:12:57.376Z","repository":{"id":201859301,"uuid":"705143417","full_name":"sgoudham/office-hours","owner":"sgoudham","description":"Simple library to only execute code within office hours","archived":false,"fork":false,"pushed_at":"2023-10-20T16:36:34.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T22:12:53.026Z","etag":null,"topics":["business","corporate","fun","library","office","office-hours","rust","time"],"latest_commit_sha":null,"homepage":"https://docs.rs/office-hours/","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgoudham.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-15T06:39:08.000Z","updated_at":"2023-10-20T23:50:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"f58ca837-f528-419a-ab74-b5715a9aa561","html_url":"https://github.com/sgoudham/office-hours","commit_stats":null,"previous_names":["sgoudham/office-hours"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Foffice-hours","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Foffice-hours/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Foffice-hours/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Foffice-hours/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgoudham","download_url":"https://codeload.github.com/sgoudham/office-hours/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487684,"owners_count":21112190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["business","corporate","fun","library","office","office-hours","rust","time"],"created_at":"2024-10-13T23:07:36.195Z","updated_at":"2025-04-11T22:12:57.342Z","avatar_url":"https://github.com/sgoudham.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# office-hours\n\nAre you tired of your code working all day every day? Don't you feel bad that your code keeps working while you're off\nrelaxing and having fun after work?\n\nWell now you can use the power of `office-hours` to only run your code within the working hours of the day!\n\n\u003e [!IMPORTANT]  \n\u003e At the time of writing, the office hours are determined from the **Local Time Zone**\n\u003e of the host machine where the code is running. I might consider updating this library\n\u003e to support other timezones if I **really** want to suffer :P\n\n## Usage\n\n1. Add this library to your project\n\n    ```shell\n    cargo add office-hours\n    ```\n\n2. Import and use the `OfficeHours` struct\n\n    ```rust\n    use office_hours::OfficeHours;\n\n    fn main() {\n        // 9am to 5pm are the default office hours\n        let office_hours = OfficeHours::default();\n        if office_hours.now() {\n            println!(\"Blimey! Is it time for work already?\");\n        } else {\n            println!(\"Phew, still on break!\");\n        }\n    }\n    ```\n\n3. **(Optional)** Import and use the `office_hours!` macro\n\n    ```rust\n    use office_hours::office_hours;\n   \n    fn main() {\n        office_hours!({\n            println!(\"Blimey! Is it time for work already?\");\n        }) \n    }\n    ```\n\n   Further examples can be found in the [examples/](/examples) directory. (`cargo run --example default_hours`)\n\n## Development\n\n\u003e [!NOTE]\n\u003e The Minimum Supported Rust Version is **1.60.0**\n\n1. Clone repository\n\n    ```shell\n    git clone https://github.com/sgoudham/office-hours.git\n    cd office-hours\n    ```\n\n2. Build\n\n    ```shell\n    cargo build --release\n    ```\n\n3. Test\n\n    ```shell\n    cargo test --verbose\n    ```\n\n## License\n\n[MIT](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgoudham%2Foffice-hours","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgoudham%2Foffice-hours","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgoudham%2Foffice-hours/lists"}