use strict;
use warnings;
use POSIX;

package wloh_common;

sub output_last_sync {
	my $dbh = shift;
	my $ref = $dbh->selectrow_hashref('SELECT EXTRACT(EPOCH FROM last_sync) AS last_sync FROM last_sync');
	if (!defined($ref)) {
		print "    <p class=\"lastsync\">Databasen ble sist synkronisert (ukjent).</p>\n";
	} else {
		my $ts = POSIX::strftime("%Y-%m-%d %H:%M %Z", localtime($ref->{'last_sync'}));
		print "    <p class=\"lastsync\">Databasen ble sist synkronisert $ts.</p>\n";
	}
}

1;
