By Anthony Mico

Over the last few weeks I've written a number of custom ITM Agent Builder agents, several of which have included timestamp attributes.  Here is the Perl code I've used for converting a UTC/epoch time to the Candletime format used to populate an ITM Agent Builder Timestamp type attribute.

#!/usr/bin/perl

#

# Script to convert a utc/epoch time into Candletime

# CYYMMDDHHMMSSmmm (where C=1 for the 21st century)

#

# Call it without an argument to get the current time, or

# with an epoch to convert (noting that future/past DST changes

# etc are not supported).

#

# Millisecond value is always returned as 000.

#

# Ant Mico Orb Data Ltd.

use strict;

use warnings;

my $time = @ARGV ? shift : time;

my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($time))[0,1,2,3,4,5];

print map { sprintf("%02d", $_) } ($year, ++$mon, $mday, $hour, $min, $sec);

print "000";

Twitter Feed

OrbData RT @OrbData: If you missed our #IBMInterConnnect session "NOI: Achieving IT Operations Efficiency" please come to stand 167 & we'll send y…
OrbData If you missed our #IBMInterConnnect session "NOI: Achieving IT Operations Efficiency" please come to stand 167 & we'll send you the slides

Address

Address:
100 Longwater Avenue, Green Park, Reading, RG2 6GP, U.K.
Tel:
+44 (0) 118 945 0130
E-Mail:
This email address is being protected from spambots. You need JavaScript enabled to view it.

markerFind on Google Maps

About Us

Orb Data brings together People, Process and Technology to deliver the cornerstone of business success: the management of IT infrastructure. At our heart are our people. We have unrivalled experience, helping us to achieve an enviable reputation for excellence in project delivery. Because we’re independent, we identify actual issues and help organisations resolve them –from spec to deployment, and beyond –providing the right solution in terms of best of breed technology and support. We offer a refreshingly simple approach to the way we conduct business. We take pride in our abilities to provide first class solutions to business problems, and to conduct working relationships with honesty and integrity.

Follow Us On:

JoomShaper