=head1 NAME

CFX5::TimeDate - Routines for time / date handling

=head1 SYNOPSIS

Routines for time date handling

=head1 DESCRIPTION

$Id$

=cut

package CFX5::TimeDate;

use strict;
use Time::localtime;

use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);
use Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(timedatestamp);

=head2 timedatestamp

  $value = timedatestamp();

Returns a time and date stamp of the form:

'at hh:mm:ss on dd MMM YYYY'

e.g. 

'at 14:34:02 on 08 Feb 2023'

This allows a consistent format to be used throughout.

=cut

sub timedatestamp {
  my $t = localtime();
  my $mname = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$t->mon()];
  my $date = sprintf "at %02d:%02d:%02d on %02d %s %d",
                     $t->hour(), $t->min(), $t->sec(),
                     $t->mday(), $mname, $t->year()+1900;
  return $date;
}

1;
