2006-10-02

what time is it?

No time for home tech projects lately... been too busy at work. The only thing of note was a minor perl script that went through my digital picture archives looking for images that accidentally had a timestamp of 01/01/2000 00:00:00. That's the timestamp my Olympus C-3030Zoom gives a pic after battery ran out and it's forgotten the date/time. I didn't actually change the JPEG timestamp that's builtin to the image, just the filesystem mtime. That's a whole other perl script and some fancy perl modules. Here's the meat-n-potatoes of the script:

my ($fmonth,$fday,$num,$ext) = $dirent =~ /P(.)(..)(....)(\.jpg)/i;
if ( ( $fmonth eq "1" && $fday eq "01") && ($month != 1 && $day != 1) ) {
my $newdirent = sprintf("P%1X%02d%04d%s",$month,$day,$num,$ext);
print "should rename $dir/$dirent to $dir/$newdirent\n";
`mv $dir/$dirent $dir/$newdirent`;
$dirent=$newdirent;
}
$num += 0;
my $hour = 12 + int($num / 60);
my $min = $num % 60;
my $sec = 0;
my $time = Mktime($year,$month,$day, $hour,$min,$sec);
my $dstring = localtime($time);
my $f = "$dir/$dirent";
print "timestamp '$f' as $dstring\n";
utime $time, $time, $f

Labels:

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home