#! /usr/bin/perl
#
# Software- und Organisations-Service GmbH, 2005, www.sos-berlin.com
# Andreas Püschel, 2005-05-30, andreas.pueschel@sos-berlin.com
#


#------------------------------------------------------------------------------------get_local_date

sub get_local_date 
{
    my ($day, $month, $year) = (localtime)[3,4,5];
    if ($day < 10){$day   = "0".$day;}
    $month++;
    if ($month < 10){$month   = "0".$month;}
    return (($year+1900) . "-$month-$day");
 }

#------------------------------------------------------------------------------------get_local_time

sub get_local_time 
{
    my ($sec,$min,$hour)  = (localtime)[0,1,2];
    if ($sec < 10) {$sec  = "0".$sec;}
    if ($min < 10) {$min  = "0".$min;}
    if ($hour < 10){$hour = "0".$hour;}
    return ("$hour:$min:$sec");
}

#--------------------------------------------------------------------------------------------------

$logfile = "./logs/sample_script_notification.log";

open ( STDLOG, ">$logfile") or die( "could not access log file $logfile: " . $! );
print( STDLOG "current time: " . get_local_date() . " " . get_local_time() );
close( STDLOG);

print( "current time: " . get_local_date() . " " . get_local_time() );