{"id":15371338,"url":"https://github.com/sultaniman/every","last_synced_at":"2025-12-11T23:51:25.152Z","repository":{"id":40305391,"uuid":"152765938","full_name":"sultaniman/every","owner":"sultaniman","description":"Calculate even time intervals","archived":false,"fork":false,"pushed_at":"2023-03-30T05:02:15.000Z","size":129,"stargazers_count":12,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-15T14:05:15.921Z","etag":null,"topics":["elixir","every","genserver","hour","interval","minute"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sultaniman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-12T14:52:44.000Z","updated_at":"2023-06-20T16:30:28.000Z","dependencies_parsed_at":"2023-07-12T15:46:00.872Z","dependency_job_id":null,"html_url":"https://github.com/sultaniman/every","commit_stats":null,"previous_names":["imanhodjaev/every"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fevery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fevery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fevery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fevery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sultaniman","download_url":"https://codeload.github.com/sultaniman/every/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249085439,"owners_count":21210267,"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":["elixir","every","genserver","hour","interval","minute"],"created_at":"2024-10-01T13:46:29.082Z","updated_at":"2025-12-11T23:51:25.122Z","avatar_url":"https://github.com/sultaniman.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Every\n\n[![Build Status](https://travis-ci.com/imanhodjaev/every.svg?branch=master)](https://travis-ci.com/imanhodjaev/every)\n[![Coverage Status](https://coveralls.io/repos/github/imanhodjaev/every/badge.svg?branch=master\u0026v=1)](https://coveralls.io/github/imanhodjaev/every?branch=master)\n\nCalculate even intervals for. Sometimes we need to have\nperiodic tasks to be executed exactly at certain time points, for example running\na task every 15 minutes.\n\n1. At the beginning of hour,\n2. 15th minute,\n3. 30th minute,\n4. 45th minute.\n\nSo instead of doing it manually, it is better if it is automated.\n\n## Usage\n\nAvailable functions:\n\n* `Every.minute/1`\n* `Every.minutes/2`\n* `Every.hour/1`\n* `Every.hours/2`\n* `Every.day/1`\n\nAll functions accept an optional `relative_to` (`DateTime` or `NaiveDateTime`)\nparameter which can be used to fake the current moment in time. If it is not\nprovided, the current time will be used.\n\n`Every.minute/1`, `Every.hour/1` and `Every.day/1` only accept the optional\n`relative_to` parameter. They return the milliseconds left until the next\nminute/hour/day.\n\n`Every.minutes/2` and `Every.hours/2` both accept an interval as first parameter\nand the optional `relative_to` as second parameter. They return the milliseconds\nuntil the the next interval.\n\n**Note:** All functions return the difference in milliseconds!\n\n### How to use with periodic tasks\n\n```elixir\n# Lets say we want to trigger our task every 5 minutes and current time is 12:02\n# so next calls will be at 12:05, 12:10 ... 12:55 ...\nProcess.send_after(self(), :work, Every.minutes(5))\n\n# If we want to trigger every minute\nProcess.send_after(self(), :work, Every.minute())\n\n# If we want to trigger every hour\nProcess.send_after(self(), :work, Every.hour())\n\n# If we want to trigger every 2 hours\nProcess.send_after(self(), :work, Every.hours(2))\n\n# If we want to trigger every day\nProcess.send_after(self(), :work, Every.day())\n```\n\n## Installation\n\nThis library can be installed by adding `every` to the list of dependencies in\nyour `mix.exs`:\n\n```elixir\ndef deps do\n  [{:every, \"~\u003e 0.0.9\"}]\nend\n```\n\nhttps://hex.pm/packages/every\n\nHave fun!\n\n---------------------------------------------------------------------\n\n\u003cp align=\"center\"\u003e\n  ✨ 🍰 ✨\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultaniman%2Fevery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsultaniman%2Fevery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultaniman%2Fevery/lists"}