{"id":19509586,"url":"https://github.com/raspi/timeaverage","last_synced_at":"2025-02-25T22:44:02.442Z","repository":{"id":138160093,"uuid":"229301912","full_name":"raspi/timeaverage","owner":"raspi","description":"Moving average window","archived":false,"fork":false,"pushed_at":"2019-12-20T17:25:26.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-11T06:32:54.755Z","etag":null,"topics":["average","go","golang","time"],"latest_commit_sha":null,"homepage":"","language":"Go","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/raspi.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-20T16:44:33.000Z","updated_at":"2024-06-19T06:21:47.506Z","dependencies_parsed_at":"2024-06-19T06:21:47.247Z","dependency_job_id":"17c2271f-fa8d-4254-9c93-3c16a719a4e8","html_url":"https://github.com/raspi/timeaverage","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspi%2Ftimeaverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspi%2Ftimeaverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspi%2Ftimeaverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspi%2Ftimeaverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raspi","download_url":"https://codeload.github.com/raspi/timeaverage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240761105,"owners_count":19853255,"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":["average","go","golang","time"],"created_at":"2024-11-10T23:12:33.814Z","updated_at":"2025-02-25T22:44:02.381Z","avatar_url":"https://github.com/raspi.png","language":"Go","readme":"# timeaverage\n\nCall a function which returns a float every X duration and keep history of N values and return average value of that window.  \n\n## Install\n    go get -u github.com/raspi/timeaverage\n    \n## Example\n\nTake measurement every 500 ms and keep history of 10 seconds.\n\n```go\npackage main\n\nimport (\n\t\"github.com/raspi/timeaverage\"\n    \"log\"\n\t\"time\"\n)\n\nfunc exampleSampler() (float64, error) {\n\treturn 1, nil\n}\n\nfunc main() {\n\tavg := timeaverage.New(time.Second*10, time.Millisecond*500, 0.0, exampleSampler)\n\tavg.Start()\n\n\tfor {\n\t\tv := avg.Average()\n\t\tlog.Printf(`%f`, v)\n\t\ttime.Sleep(time.Second * 1)\n\t}\n\n}\n```\n\nSee [_examples](_examples/) directory for more examples.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraspi%2Ftimeaverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraspi%2Ftimeaverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraspi%2Ftimeaverage/lists"}