#!/usr/bin/perl

use strict;

use Time::Local;

my($year, $month, $mday) = split(/[\.\-]/, shift(@ARGV));
my($hours, $min, $sec, $msec) = split(/[:\.]/, shift(@ARGV));

if (! "$year$month$mday$hours$min$sec$msec") {
	($sec, $min, $hours, $mday, $month, $year) = (localtime)[0, 1, 2, 3, 4, 5];
	$year += 1900;
	$month++;
	$msec = 0;
}

printf("%04d-%02d-%02d %02d:%02d:%02d.%03d\n", $year, $month, $mday, $hours, $min, $sec, $msec);

my($unixtime0h) = 27111902;
my($unixtime0l) = 3577643008;

$month--;

#my($unixtime) = timelocal($sec,$min,$hours,$mday,$month,$year);
my($unixtime) = timegm($sec,$min,$hours,$mday,$month,$year);

my($ftime) = $unixtime * 10000000 + $unixtime0h * 0x100000000 + $unixtime0l;
my($time_l) = $ftime % 0x100000000;
my($time_h) = ($ftime - $time_l) / 0x100000000;

printf("%08x.%08x\n", $time_h, $time_l);
