{"id":20972353,"url":"https://github.com/michaelchadwick/clocker","last_synced_at":"2025-07-14T09:41:14.673Z","repository":{"id":32338724,"uuid":"35914166","full_name":"michaelchadwick/clocker","owner":"michaelchadwick","description":"Display elapsed time for a chunk 'o Ruby code","archived":false,"fork":false,"pushed_at":"2023-09-08T03:11:32.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-06T03:47:14.643Z","etag":null,"topics":["cli","ruby","rubygem","time"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"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/michaelchadwick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2015-05-19T23:27:49.000Z","updated_at":"2024-02-22T14:15:35.000Z","dependencies_parsed_at":"2024-11-19T04:07:48.057Z","dependency_job_id":"4ad2f696-efbe-42db-8107-666dd03edf3d","html_url":"https://github.com/michaelchadwick/clocker","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/michaelchadwick/clocker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelchadwick%2Fclocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelchadwick%2Fclocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelchadwick%2Fclocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelchadwick%2Fclocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelchadwick","download_url":"https://codeload.github.com/michaelchadwick/clocker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelchadwick%2Fclocker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264915753,"owners_count":23682940,"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":["cli","ruby","rubygem","time"],"created_at":"2024-11-19T04:07:45.289Z","updated_at":"2025-07-14T09:41:14.614Z","avatar_url":"https://github.com/michaelchadwick.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clocker\n\n[![Gem Version](https://badge.fury.io/rb/clocker.svg)](http://badge.fury.io/rb/clocker)\n\nA simple RubyGem that reports how long a specific Ruby command or block of code takes to run.\n\n## Usage\n### Command Line\nSimply run `clocker` followed by a command or block of code. Add an `-m` before the command or block to print out start and end times.\n\nEx. 1\n```\n$ clocker \"puts 'hi'\"\nhi\nClocked at 0 mins, 0 secs, 0 ms\n```\n\nEx. 2\n```\n$ clocker \"2.times { puts 'hello world'; sleep(0.6) }\"\nhello world\nhello world\n\nClocked at 0 mins, 1 secs, and 210 ms\n```\n\nEx. 3\n```\n$ clocker -m \"1.upto(5) { |i| print i+1; sleep(0.4) }\"\nstart: 2015-08-18 16:16:47 -0700\n23456\nended: 2015-08-18 16:16:49 -0700\n\nClocked at 0 mins, 2 secs, and 12 ms\n```\n\n### Gem Library\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'clocker'\n```\n\nAnd then execute:\n```\n$ bundle\n```\n\nOr install it yourself as:\n```\n$ gem install clocker\n```\n\nSample code block:\n```ruby\n\u003e\u003e clocker = Clocker.new\n\u003e\u003e clocker.clock do\n\u003e\u003e  # code here\n\u003e\u003e end\n```\n\nBy default, clocker will not print out the start time before the command|block, or the end time after the command|block, unless you pass the instance `show_messages: true`.\n\n```ruby\n\u003e\u003e c1 = Clocker.new\n\u003e\u003e duration = c1.clock do\n\u003e\u003e  3.times { print 'c1'; sleep(1) }\n\u003e\u003e end\n\u003e\u003e puts\n\u003e\u003e puts duration\n\nc1c1c1\n{:mins=\u003e0, :secs=\u003e3, :ms=\u003e13}\n```\n\n```ruby\n\u003e\u003e c2 = Clocker.new(show_messages: true)\n\u003e\u003e duration = c2.clock do\n\u003e\u003e  3.times { print 'c2'; sleep(1) }\n\u003e\u003e end\n\u003e\u003e puts duration\n\nstart: 2015-08-18 16:07:17 -0700\nc2c2c2\nended: 2015-08-18 16:07:20 -0700\n{:mins=\u003e0, :secs=\u003e3, :ms=\u003e14}\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/michaelchadwick/clocker.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelchadwick%2Fclocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelchadwick%2Fclocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelchadwick%2Fclocker/lists"}