1755723 Members
3047 Online
108837 Solutions
New Discussion юеВ

Re: Timestamp problem

 
SOLVED
Go to solution
Ryan Ma
Frequent Advisor

Timestamp problem

I am writing a program to convert timestamp back to date/time format.

But it fail to compile.

I think this is because I use the kernel compiler which has limit function.

So how can I do it in other way?

Thx.
5 REPLIES 5
Rainer von Bongartz
Honored Contributor

Re: Timestamp problem

If it depends on the compiler you should install a full ANSI compiler like gcc
Download it from :

http://hpux.cs.utah.edu/hppd/hpux/Gnu/gcc-3.0.1/

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Robin Wakefield
Honored Contributor
Solution

Re: Timestamp problem

Hi,

Can you use perl, e.g.:

# perl -e 'print scalar localtime($ARGV[0]),"\n"' 1008145059
Wed Dec 12 08:17:39 2001

Rgds, Robin
James R. Ferguson
Acclaimed Contributor

Re: Timestamp problem

Hi Ryan:

You can also do this:

# TS=1000000000
echo "0d${TS}=Y"|adb

Regards!

...JRF...
Ryan Ma
Frequent Advisor

Re: Timestamp problem

Hi Robin,

Why I produce no result?
I follow your command already.

# perl -e 'print scalar localtime($ARGV[0]),"\n"' 1008145059

Rgds,
Ryan
Robin Wakefield
Honored Contributor

Re: Timestamp problem

Hi Ryan,

I guess you're running V4 of perl. The long-winded way for V4 would be to create a perl script:

@dow=("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
@moy=("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
($sec, $min, $hour, $day, $month, $year, $wday)=(localtime($ARGV[0]))[0,1,2,3,4,5,6];
printf ("%s %s %02d %02d:%02d:%02d %04d\n",$dow[$wday],$moy[$month],$day,$hour,$min,$sec,$year+1900);

then run:

# perl yourscript timestamp

Rgds, Robin