timeStamp

The timeStamp method returns a timestamp in a format suitable for addition to the NCIM topology database.

Method Synopsis

NCP::DBI_Factory::timeStamp([$unixtimestamp])

Parameters

$unixtimestamp
Specifies a UNIX timestamp. This is an optional parameter. If you do not specify this parameter, the timeStamp method uses the current timestamp on the local host.

Description

The timeStamp method converts the current timestamp on the local host (or the UNIX timestamp if specified in the unixtimestamp parameter) to the following format that is suitable for addition to the requested NCIM topology database:

YYYY-MM-DD HH:MM:SS

where:

  • YYYY — Specifies the year.
  • MM — Specifies the month.
  • DD — Specifies the day.
  • HH — Specifies the hour.
  • MM — Specifies the minutes.
  • SS — Specifies the seconds.

The timeStamp method adds leading zeroes to any of the previous fields whose values are less than 10.

Example Usage

The following code example illustrates a call to the timeStamp method, specifying the current timestamp on the local host:

.
.
.
my $currenttime
$currenttime = timestamp();
.
.
.

If the current timestamp on the local host is June 6, 2010 5:39:45 EST, the timeStamp method converts it to the following format that is suitable for addition to the requested NCIM topology database:

2010-06-04-18:39:45

The following code example illustrates a call to the timeStamp method, specifying a UNIX timestamp:


my $currenttime
$currenttime = timestamp(1275694785);

The timeStamp method converts this UNIX timestamp to the following format that is suitable for addition to the requested database:

2010-06-04-18:39:45

Returns

Upon completion, the currentTimeStamp method returns the current timestamp on the local host (or the UNIX timestamp) in the following format:

YYYY-MM-DD HH:MM:SS