{"id":20315231,"url":"https://github.com/sysread/time-spent","last_synced_at":"2025-07-02T19:37:15.190Z","repository":{"id":56840057,"uuid":"60645576","full_name":"sysread/Time-Spent","owner":"sysread","description":"Perl module for tracking time using a rolling average","archived":false,"fork":false,"pushed_at":"2018-02-26T17:49:23.000Z","size":9,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T15:07:47.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysread.png","metadata":{"files":{"readme":"README.pod","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-07T20:52:07.000Z","updated_at":"2016-06-07T20:56:01.000Z","dependencies_parsed_at":"2022-08-29T05:01:06.459Z","dependency_job_id":null,"html_url":"https://github.com/sysread/Time-Spent","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sysread/Time-Spent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FTime-Spent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FTime-Spent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FTime-Spent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FTime-Spent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysread","download_url":"https://codeload.github.com/sysread/Time-Spent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2FTime-Spent/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263204706,"owners_count":23430280,"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":[],"created_at":"2024-11-14T18:18:23.554Z","updated_at":"2025-07-02T19:37:15.134Z","avatar_url":"https://github.com/sysread.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"=pod\n\n=encoding UTF-8\n\n=head1 NAME\n\nTime::Spent - Track events and calculate a rolling average of time, er, spent\n\n=head1 VERSION\n\nversion 0.02\n\n=head1 SYNOPSIS\n\n  use Time::Spent;\n\n  my $tracker = Time::Spent-\u003enew( length =\u003e 3 );\n\n  $tracker-\u003estart( 'foo' );\n  sleep 3;\n  $tracker-\u003estop( 'foo' );\n  $tracker-\u003eavg; # 3 = 3/1\n\n  $tracker-\u003estart( 'bar' );\n  sleep 1;\n  $tracker-\u003estop( 'bar' );\n  $tracker-\u003eavg; # 2 = (3+1)/2\n\n  $tracker-\u003estart( 'baz' );\n  sleep 5;\n  $tracker-\u003estop( 'baz' );\n  $tracker-\u003eavg; # 3 = (3+1+5)/3;\n\n  $tracker-\u003estart( 'bat' );\n  sleep 6;\n  $tracker-\u003estop( 'bat' );\n  $tracker-\u003eavg; # 4 = (1+5+6)/3\n\n\n  my $tracker = Time::Spent-\u003enew( length =\u003e 3 );\n\n  $tracker-\u003estart( 'life' );\n  sleep 35;\n  $tracker-\u003estart( 'universe' );\n  sleep 76;\n  $tracker-\u003estart( 'everything' );\n  sleep 15;\n\n  $tracker-\u003estop( 'life', 'universe', 'everything' );\n  $tracker-\u003eavg; # 42 (GET IT?!)\n\n=head1 DESCRIPTION\n\nC\u003cTime::Spent\u003e uses a simple rolling average to track tasks by the amount of\ntime they take.\n\n=head1 METHODS\n\n=head2 new\n\nCreate a new C\u003cTime::Spent\u003e object. Accepts one named parameter, C\u003clength\u003e,\nwhich must be a positive whole number specifying the number of historical\nentries to use in the calculation of the rolling average.\n\n  Time::Spent-\u003enew( length =\u003e 30 );\n\n=head2 start\n\nBegins tracking for the specified identifiers. Returns the number of new\nspecifiers tracked. Croaks if the identifier is already being tracked or if no\nidentifiers are provided.\n\n  $tracker-\u003estart( 'ident1', 'ident2', 'ident3' ); # returns 3\n  $tracker-\u003estart( 'ident1' ); # croaks because ident1 is already tracked\n\n=head2 stop\n\nCompletes tracking for the specified identifiers. The time taken since the call\nto L\u003c/start\u003e for each identifier is then added to the historical average time.\nRemoves completed entries' times from tracking as needed to maintain the\nexpected history length. Croaks if any provided identifier is not tracked or if\nno identifiers are provided.\n\n  $tracker-\u003estop( 'ident1' );                      # croaks because ident1 is not tracked\n  $tracker-\u003estart( 'ident1' );\n  $tracker-\u003estop( 'ident1' );                      # returns 1\n  $tracker-\u003estart( 'ident1', 'ident2', 'ident3' ); # ok because we stopped tracking ident1\n  $tracker-\u003estop( 'ident1' );                      # returns 1\n  $tracker-\u003estop( 'ident2', 'ident3' );            # returns 2\n\n=head2 avg\n\nReturns the average time taken for tracked identifiers.\n\n=head2 is_tracking\n\nReturns true if the identifier passed is currently being tracked (that is, it\nhas been L\u003c/start\u003eed but not L\u003c/stop\u003eped.\n\n=head1 AUTHOR\n\nJeff Ober \u003csysread@fastmail.fm\u003e\n\n=head1 COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2017 by Jeff Ober.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n\n=cut\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysread%2Ftime-spent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysread%2Ftime-spent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysread%2Ftime-spent/lists"}