diff --git a/Changes b/Changes index f469652..e5e613d 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Release history for Acme-Time-Constant +0.001003 2014-08-30T07:49:40Z + [00 Trivial] + - Improve test coverage. + - Pull timespace and subspace closer together. + 0.001002 2014-08-30T00:35:43Z [00 Trivial] - no code changes diff --git a/MANIFEST b/MANIFEST index ee49166..d991905 100644 --- a/MANIFEST +++ b/MANIFEST @@ -24,6 +24,7 @@ t/00-compile/lib_Acme_Time_Constant_pm.t t/00-report-prereqs.dd t/00-report-prereqs.t t/basic.t +t/noargs.t weaver.ini xt/author/critic.t xt/release/cpan-changes.t diff --git a/META.json b/META.json index 79248ef..61ae478 100644 --- a/META.json +++ b/META.json @@ -107,7 +107,7 @@ "provides" : { "Acme::Time::Constant" : { "file" : "lib/Acme/Time/Constant.pm", - "version" : "0.001002" + "version" : "0.001003" } }, "release_status" : "stable", @@ -122,7 +122,7 @@ "web" : "https://github.com/kentnl/Acme-Time-Constant" } }, - "version" : "0.001002", + "version" : "0.001003", "x_BuiltWith" : { "modules" : { "CPAN::Meta" : "2.142060", @@ -434,11 +434,6 @@ "name" : "Version", "version" : "4.006" }, - { - "class" : "Pod::Weaver::Section::Region", - "name" : "prelude", - "version" : "4.006" - }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", @@ -454,11 +449,21 @@ "name" : "OVERVIEW", "version" : "4.006" }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "abouttime", + "version" : "4.006" + }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.006" }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "FUNCTIONS", + "version" : "4.006" + }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", @@ -626,7 +631,7 @@ "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "signed" : 0, - "tag" : "0.001002-source", + "tag" : "0.001003-source", "tag_format" : "%v-source", "tag_message" : "v%v", "time_zone" : "local" @@ -697,7 +702,7 @@ "Dist::Zilla::Plugin::Git::Tag" : { "branch" : "releases", "signed" : 0, - "tag" : "0.001002", + "tag" : "0.001003", "tag_format" : "%v", "tag_message" : "v%v", "time_zone" : "local" diff --git a/META.yml b/META.yml index 7ab3586..ca9c027 100644 --- a/META.yml +++ b/META.yml @@ -18,7 +18,7 @@ name: Acme-Time-Constant provides: Acme::Time::Constant: file: lib/Acme/Time/Constant.pm - version: '0.001002' + version: '0.001003' requires: Sub::Exporter::Progressive: '0' Time::HiRes: '0' @@ -31,7 +31,7 @@ resources: bugtracker: https://github.com/kentnl/Acme-Time-Constant/issues homepage: https://github.com/kentnl/Acme-Time-Constant repository: https://github.com/kentnl/Acme-Time-Constant.git -version: '0.001002' +version: '0.001003' x_BuiltWith: modules: CPAN::Meta: '2.142060' @@ -287,10 +287,6 @@ x_Dist_Zilla: class: Pod::Weaver::Section::Version name: Version version: '4.006' - - - class: Pod::Weaver::Section::Region - name: prelude - version: '4.006' - class: Pod::Weaver::Section::Generic name: SYNOPSIS @@ -303,10 +299,18 @@ x_Dist_Zilla: class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.006' + - + class: Pod::Weaver::Section::Region + name: abouttime + version: '4.006' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.006' + - + class: Pod::Weaver::Section::Collect + name: FUNCTIONS + version: '4.006' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES @@ -433,7 +437,7 @@ x_Dist_Zilla: Dist::Zilla::Plugin::Git::Tag: branch: ~ signed: '0' - tag: 0.001002-source + tag: 0.001003-source tag_format: '%v-source' tag_message: v%v time_zone: local @@ -487,7 +491,7 @@ x_Dist_Zilla: Dist::Zilla::Plugin::Git::Tag: branch: releases signed: '0' - tag: '0.001002' + tag: '0.001003' tag_format: '%v' tag_message: v%v time_zone: local diff --git a/Makefile.PL b/Makefile.PL index 4424623..3405338 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -32,7 +32,7 @@ my %WriteMakefileArgs = ( "File::Spec" => 0, "Test::More" => "0.89" }, - "VERSION" => "0.001002", + "VERSION" => "0.001003", "test" => { "TESTS" => "t/*.t t/00-compile/*.t" } diff --git a/README b/README index ae9b8e3..caf7cc5 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME Acme::Time::Constant - Run any code in constant time. VERSION - version 0.001002 + version 0.001003 SYNOPSIS This code contains within it, the golden calf of computer science: The @@ -57,6 +57,11 @@ BUGS simply our devilish tactic to make the conspirators think we're willingly playing for them. You know better. ;) +FUNCTIONS + "constant_time" + constant_time( $time, $callback ); + constant_time( $callback ); # $time defaults to 1 second. + AUTHOR Kent Fredric diff --git a/lib/Acme/Time/Constant.pm b/lib/Acme/Time/Constant.pm index 2c0e27f..8ac0442 100644 --- a/lib/Acme/Time/Constant.pm +++ b/lib/Acme/Time/Constant.pm @@ -5,7 +5,7 @@ use utf8; package Acme::Time::Constant; -our $VERSION = '0.001002'; +our $VERSION = '0.001003'; # ABSTRACT: Run any code in constant time. @@ -33,6 +33,9 @@ BEGIN { $old_import = \&import } + + + sub constant_time { my $nargs = ( my ( $time, $callback ) = @_ ); @@ -60,7 +63,7 @@ Acme::Time::Constant - Run any code in constant time. =head1 VERSION -version 0.001002 +version 0.001003 =head1 SYNOPSIS @@ -82,8 +85,6 @@ This code contains within it, the golden calf of computer science: The ability t print $timestamp - time; # 2 seconds -=for Pod::Coverage constant_time - =head1 BUGS =head4 General relativity does not hold in the context of this code. @@ -115,6 +116,13 @@ knowledge of. One may note that this module depends on C, but this is simply our devilish tactic to make the conspirators think we're willingly playing for them. You know better. ;) +=head1 FUNCTIONS + +=head2 C + + constant_time( $time, $callback ); + constant_time( $callback ); # $time defaults to 1 second. + =head1 AUTHOR Kent Fredric diff --git a/misc/Changes.deps b/misc/Changes.deps index 638e87d..3de1878 100644 --- a/misc/Changes.deps +++ b/misc/Changes.deps @@ -1,6 +1,8 @@ This file contains changes in REQUIRED dependencies for standard CPAN phases (configure/build/runtime/test) -0.001002 +0.001003 + +0.001002 2014-08-30T00:35:43Z 0.001001 2014-08-15T21:11:15Z diff --git a/misc/Changes.deps.all b/misc/Changes.deps.all index f71c3fe..b1fda16 100644 --- a/misc/Changes.deps.all +++ b/misc/Changes.deps.all @@ -1,6 +1,8 @@ This file contains ALL changes in dependencies in both REQUIRED / OPTIONAL dependencies for all phases (configure/build/runtime/test/develop) -0.001002 +0.001003 + +0.001002 2014-08-30T00:35:43Z [Added / develop requires] - Dist::Zilla::Plugin::Author::KENTNL::RecommendFixes 0.001001 diff --git a/misc/Changes.deps.dev b/misc/Changes.deps.dev index fd042a6..2564f18 100644 --- a/misc/Changes.deps.dev +++ b/misc/Changes.deps.dev @@ -1,6 +1,8 @@ This file contains changes to DEVELOPMENT dependencies only ( both REQUIRED and OPTIONAL ) -0.001002 +0.001003 + +0.001002 2014-08-30T00:35:43Z [Added / develop requires] - Dist::Zilla::Plugin::Author::KENTNL::RecommendFixes 0.001001 diff --git a/misc/Changes.deps.opt b/misc/Changes.deps.opt index cbb54a4..b6ee8a2 100644 --- a/misc/Changes.deps.opt +++ b/misc/Changes.deps.opt @@ -1,6 +1,8 @@ This file contains changes in OPTIONAL dependencies for standard CPAN phases (configure/build/runtime/test) -0.001002 +0.001003 + +0.001002 2014-08-30T00:35:43Z 0.001001 2014-08-15T21:11:15Z diff --git a/t/basic.t b/t/basic.t index 2e1053c..6c5cfe9 100644 --- a/t/basic.t +++ b/t/basic.t @@ -26,7 +26,7 @@ $timestamp = time; constant_time( 1 => sub { my $j; - for my $i ( 0 .. 50_000_000 ) { + for my $i ( 0 .. 2_000_000 ) { $j += $i; } } diff --git a/t/noargs.t b/t/noargs.t new file mode 100644 index 0000000..56f80dd --- /dev/null +++ b/t/noargs.t @@ -0,0 +1,25 @@ +use strict; +use warnings; + +use Test::More; + +# FILENAME: basic.t +# CREATED: 08/04/14 15:40:32 by Kent Fredric (kentnl) +# ABSTRACT: Test the continuum + +use Acme::Time::Constant qw( constant_time ); + +my $timestamp = time; +constant_time( + sub { + my $j; + for my $i ( 0 .. 1 ) { + $j += $i; + } + } +); +my $delta = time - $timestamp; +cmp_ok( $delta, '>', 0.5, 'Constant time fixed at at least 0.5 second pass 1' ); +cmp_ok( $delta, '<', 1.5, 'Constant time fixed at at most 1.5 second pass 1' ); + +done_testing; diff --git a/weaver.ini b/weaver.ini index e6f2b37..5d18e84 100644 --- a/weaver.ini +++ b/weaver.ini @@ -4,17 +4,21 @@ [Name] [Version] -[Region / prelude] [Generic / SYNOPSIS] [Generic / DESCRIPTION] [Generic / OVERVIEW] +[Region / abouttime] + ;[Generic / METHODS] ;[Collect / METHODS] [Collect / METHODS] command = method +[Collect / FUNCTIONS] +command = function + [Collect / ATTRIBUTES] command = attr