0

C: Getting the time in Nano Seconds

Posted by Joys of Programming on in C/C++

clock_gettime() returns the time in seconds and nanoseconds since the epoch. The value returned can only be used in conjunction with each other. The following program shows this To compile this program And execute the program

Tags: , ,

 
0

C: Printing Current System Time

Posted by Joys of Programming on in C/C++

There are multiple functions using which you can get the current system time in seconds like gettimeofday().But usage of clock_gettime() is recommended. clock_gettime() returns the number of seconds and nano seconds since the Epoch (January 1, 1970). It’s syntax is where clk_id can take values like CLOCK_REALTIME (which we will use in the current program [...]

Tags: , , , ,

 
0

How to Print the Current Time in Human Readable Format in Java?

Posted by Joys of Programming on in Java

currentTimeMillis and nanoTime give the current System time in milliseconds and nano seconds. But this is not understood by humans, since the value returned by these functions is the amount of time passed since January 1,1970 To be able to display the time in human readable format, we make use of the java.util.Calendar. Calendar.getInstance() gives [...]

Tags: , ,

Copyright © 2009-2012 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.