Operating System - HP-UX
1753548 Members
5435 Online
108795 Solutions
New Discussion

Java Date/System.currentTimeMillis Not updating on HPUX ITANIUM

 
Paul_266
New Member

Java Date/System.currentTimeMillis Not updating on HPUX ITANIUM

The system date isnt getting incremented using java. The date command at the prompt displays the correct system date and time.
The java class is made to sleep for 2 seconds, create a new date object, and also check the system time..
Both the new Date as well as the System time are not being updated...!!!!
See below for:
- Java Version info
- Output
- Source code
..... Thanks!!!!!

*** version************
[egate@goopy ~/JavaTesting]$ java -version
java version "1.3.1.02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1.02-011206-02:17)
Java HotSpot(TM) Server VM (build 1.3.1 1.3.1.02-JPSE_1.3.1.02_20011206 PA1.1, mixed mode)

*** output ****************
[egate@goopy ~/JavaTesting]$ java testTime
Inside testTime
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146
DateFormat time = 2003-07-08 16:02:42.146
System.currentTimeMillis = 1057694562146

*** Source *********************
import java.util.*;
import java.text.SimpleDateFormat;

public class testTime
{
public static void main(String [] args)
{
System.out.println ("Inside testTime");
SimpleDateFormat df = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS");
for (int i=0; i<10; ++i)
{
Date now = new Date();
System.out.println ("DateFormat time = " + df.format(now));
long lTime = System.currentTimeMillis();
System.out.println ("System.currentTimeMillis = " + lTime);
try
{
Thread.sleep (1000);
System.gc();
}
catch (InterruptedException e){}
}
}
}
1 REPLY 1
Mike Stroyan
Honored Contributor

Re: Java Date/System.currentTimeMillis Not updating on HPUX ITANIUM

Your test works fine for me using java 1.4.1.
Your "java -version" output looks really strange. It seems that you are running the PA-RISC version of java under Aries emulation mode. You should download a native IPF java from http://www.hp.com/go/java