##################
# timestamp: Simplified function returns a timestamp
# calling profile: mytimestamp=×tamp();
# returns: timestamp
##################
sub timestamp {
my ($flag,$message) = @_;
my $timestamp;
my $timedate;
my $date;
my $time;
my $sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst;
my $thisday, $thismon;
my $yy,$yyyy;
($sec,$min,$hour,$mday,$mon,$yy,$wday,$yday,$isdst) = localtime(time);
$thisday= (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday];
$thismon= (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon];
#If the year month, day, hour, minute, or second, are less than 10 prepend with a 0
$yyyy = $yy + 1900; #add 1900 to get 4 digit year
$yy -= 100; #subtract 100 to get 2 digit year
if ($yy < 10 ) {
$yy = "0$yy";
}
$mon++; #add 1 to month as month array starts at 0
if ($mon < 10 ) {
$mon = "0$mon";
}
# Day
if ($mday < 10 ) {
$mday = "0$mday";
}
# Hour
if ($hour < 10 ) {
$hour = "0$hour";
}
# Min
if ($min < 10 ) {
$min = "0$min";
}
# Second
if ($sec < 10 ) {
$sec = "0$sec";
}
# TO GET FORMAT USE THIS
#=================================================
# hh:mm:ss $timestamp="$hour:$min:$sec";
# hhmmss $timestamp="$hour$min$sec";
# dd/mm/yy $timestamp="$mday/$mon/$yy";
# mm/dd/yy") $timestamp="$mon/$mday/$yy";
# mm/dd/yyyy $timestamp="$mon/$mday/$yyyy";
# yyyymmdd $timestamp="$yyyy$mon$mday";
# yyyymmddhhmm $timestamp="$yyyy$mon$mday$hour$min";
# yyyymmddhhmmss $timestamp="$yyyy$mon$mday$hour$min$sec";
# yyyy-mm-dd $timestamp="$yyyy-$mon-$mday";
# mmddyyyy $timestamp="$mon$mday$yyyy";
# dd-mm-yy $timestamp="$mday-$mon-$yy";
# dd-mm-yyyy $timestamp="$mday-$mon-$yyyy";
# mm-dd-yy $timestamp="$mon-$mday-$yy";
# mm-dd-yyyy $timestamp="$mon-$mday-$yyyy";
# dd-mmm-yyyy $timestamp="$mday-$thismon-$yyyy";
# mmm dd, yyyy $timestamp="$thismon $mday, $yyyy";
#yyyymmddhhmm
$timestamp="$yyyy$mon$mday$hour$min";
return ($timestamp);
}
Release Engineering is generally defined as the compilation, packaging and delivery of software. The release engineer is usually responsible for much more and has many roles in the software development processes. These roles can include; Supporting and improving tools for Continuous Integration, integrating automated testing, source control, and systems administration. I have collected notes over the past 20+ years and hope to post the best of them here.
Showing posts with label Perl time stamp function. Show all posts
Showing posts with label Perl time stamp function. Show all posts
Monday, July 22, 2013
Subscribe to:
Posts (Atom)