We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Here is the line of code that I am currently using to display the current system time in hr:mn:sc format:
print( hour()+":"+minute()+":"+second(),"-> ");
I would like to display hr:mn:sc:HH where HH is hundredths of a second on the system clock. I am NOT looking for the elapsed time since the program began, which would use the millis() function.
Thanks.
Answers
Based on this SimpleDateFormat tutorial: O:-)
http://docs.Oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html
This also answers another problem with the code in the question, and I have used similar not knowing about Java & now. In all the systems I have worked with it's regarded as unreliable in that at e.g. 20:59:59 you read the hours and mins, and then the time changes to 21:00:00, you read the seconds so now you have 20:59:00. You have to read the whole date and time from the system in 1 uninterruptable call. The Java call probably does that.
Yes the Java call does that. But I didn't know that the system clock even keeps milliseconds.
Just remember one thing - if you have any questions regarding things other than graphics, then search first in Google for Java.
Keep in mind that, depending on your application, displaying wall-clock time is fine (use SSS), but using wall-clock time for recording interval measurements is generally not recommended due to locales, daylight savings, etc. etc. etc. If you are recording your results as data separate from the display you may want to use millis() or System.nanoTime() -- for example see discussion: