Heheh... good question!

This one gets actual clock time, as in time of day, down to the
nanosecond, with NTP and user-initiated changes taking effect.
(Nanoseconds on solaris and linux... microseconds on mac...  "it's
complicated" on windows....).


System.nanoTime() is unrelated to time of day, and is just a counter
that increments every nanosecond.


yours,

Julius



On Fri, May 9, 2008 at 9:10 PM, Filip at Apache <[EMAIL PROTECTED]> wrote:
> nanoTime, like this one?
>
> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#nanoTime()
>
> is there a difference?
>
> Filip
>
> Julius Davies wrote:
>>
>> Hi, Commons Developers, Incubator,
>>
>>
>> I've been too busy over the last year to spend much time on incubating
>> not-yet-commons-ssl, but I just wanted to let you know that I will get
>> back into it this weekend.  I'll update the proposal (from a year ago
>> - blush!), and then find out who would still like to be involved.
>>
>>
>> [untouched for 1 year -- eek!]
>> http://wiki.apache.org/incubator/CommonsSSLProposal
>>
>>
>> I hope that Martin van den Bemt can still be the champion after all
>> this time.  Henri Yandell recently volunteered to be the mentor.
>>
>>
>> * * *
>>
>>
>> Now, totally OT, and unrelated....  would you like better timestamps
>> on java, say microsecond or nanosecond?  I'm cooking something up.
>> The people at JSR 310 also know about this:
>>
>>
>> http://juliusdavies.ca/nanotime/
>>
>>
>>
>> If you're interested, try downloading the zip file, building it, and
>> running the little test method, like so:
>>
>> unzip nanotime.zip
>> cd nanotime
>> ant
>> java -jar build/nanotime.jar
>>
>>
>> It should print out something like this:
>>
>> libjnano.so loaded!
>> 2008-05-09/14:11:14.545000000/PDT JavaTime
>> 2008-05-09/14:11:14.545567057/PDT NativeTime1
>> 2008-05-09/14:11:14.545606890/PDT NativeTime2
>>
>>
>>
>> It's rough around the edges, and the code contains very few comments.
>> You may need to hack the build file a bit to get it to build properly
>> on your platform.  So far I've succeeded on building/running on the
>> following platforms without any fiddling:
>>
>> Windows XP 32bit
>> Windows Vista 32bit
>> Linux 2.6 ppc 32bit
>> Linux 2.6 x86 64bit
>> Linux 2.6 x86 32bit
>> Linux 2.4 x86 32bit
>> Mac 10.5 x86 32bit
>> Solaris 10 sparc (64bit? not sure)
>>
>> It builds and runs against Java4, Java5, and Java6 with no problems.
>>
>>
>> Some Notes:
>> ----------------------
>>
>> * Ant is using <exec> to call gcc.
>>
>> * The windows platforms need cygwin/mingw to build, but the jar file
>> created on any platform will run on win32, because I've stored a
>> pre-built win32 DLL in the zip.
>>
>> * In other words, no matter what platform you build on, the jar file
>> will run on 32bit windows.
>>
>> * The jar file will not run on non-windows unless you build from
>> source just for your platform.
>>
>> * The native code is stored in the jar file.  On startup, Clock.java
>> copies the native code to ~/.nanotime/libjnano.so, and then loads it.
>>
>> * Every time it starts up it deletes "~/.nanotime/libjnano.so," and
>> replaces it with the copy from the jar file.  This way a newer jar
>> file will (usually) overwrite the older native file.
>>
>>
>>
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to