why is time::hires so weird
This commit is contained in:
parent
c3a05186fa
commit
db12662eab
6
blogalba
6
blogalba
|
@ -13,7 +13,7 @@ use YAML;
|
||||||
|
|
||||||
use POSIX qw/strftime/;
|
use POSIX qw/strftime/;
|
||||||
use Date::Parse qw/str2time/; #Required for converting the date field in posts to something strftime can work with
|
use Date::Parse qw/str2time/; #Required for converting the date field in posts to something strftime can work with
|
||||||
use Time::HiRes;
|
use Time::HiRes qw/gettimeofday tv_interval/;
|
||||||
use XML::RSS;
|
use XML::RSS;
|
||||||
use Unicode::Normalize;
|
use Unicode::Normalize;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ sub generate_feed {
|
||||||
}
|
}
|
||||||
sub do_cache {
|
sub do_cache {
|
||||||
return if $lastcache > (time - 3600);
|
return if $lastcache > (time - 3600);
|
||||||
$lastcache = time;my @st=Time::HiRes::gettimeofday();
|
$lastcache = time;my $st=[gettimeofday];
|
||||||
undef @posts;undef @pages;
|
undef @posts;undef @pages;
|
||||||
opendir POSTS, "$basedir/posts/" or die "Couldn't open posts directory $basedir/posts/";
|
opendir POSTS, "$basedir/posts/" or die "Couldn't open posts directory $basedir/posts/";
|
||||||
while(readdir POSTS) {
|
while(readdir POSTS) {
|
||||||
|
@ -164,7 +164,7 @@ sub do_cache {
|
||||||
generate_feed;
|
generate_feed;
|
||||||
%defparams = (
|
%defparams = (
|
||||||
INDEX => 0, NAV => [@nav], url => $blog->{url}, recent => [@posts[0 .. ($#posts > ($blog->{config}->{rss_posts}-1)? ($blog->{config}->{rss_posts}-1) : $#posts)]],
|
INDEX => 0, NAV => [@nav], url => $blog->{url}, recent => [@posts[0 .. ($#posts > ($blog->{config}->{rss_posts}-1)? ($blog->{config}->{rss_posts}-1) : $#posts)]],
|
||||||
gentime => timefmt($lastcache, '%H:%M %e/%-m/%y %Z'), genworktime => Time::HiRes::tv_interval(@st), host => $HOST,
|
gentime => timefmt($lastcache, '%H:%M %e/%-m/%y %Z'), genworktime => tv_interval($st), host => $HOST,
|
||||||
about => $blog->{about}, author => $blog->{author}, name => $blog->{name}, tagline => $blog->{tagline}, keywords => $blog->{keywords},
|
about => $blog->{about}, author => $blog->{author}, name => $blog->{name}, tagline => $blog->{tagline}, keywords => $blog->{keywords},
|
||||||
robots => $blog->{config}->{indexable}? '<meta name="ROBOTS" content="INDEX, FOLLOW" />' : '<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />',
|
robots => $blog->{config}->{indexable}? '<meta name="ROBOTS" content="INDEX, FOLLOW" />' : '<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />',
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue