×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Get time in nanoseconds with Fortran code???

Get time in nanoseconds with Fortran code???

Get time in nanoseconds with Fortran code???

(OP)
For my class I need to find Fortran function that will give me time in nanoseconds.
With date_and_time  I can get only milliseconds.

Is there a way to do it?

thanks.

RE: Get time in nanoseconds with Fortran code???

you can calculate it by multiplying ms with 1,000,000
but you can measure it only at clk resolution subject
to your clock accuracy.

<nbucska@pcperipherals.com>

RE: Get time in nanoseconds with Fortran code???

What you want is not really controlled by Fortran.   It is more a function of the operating system you are working on and the efficiency of the computer you are working with ( as nbucska suggests ).

If you are using MS Windows...   I "think" that the best you can probably hope for is 3 digits behind the decimal point.   On my Windows/Fortran system...  the tightest timing I ever get back is either to  0.05 or 0.06 seconds...  and those are probably only accurate to within 0.1 seconds or something.

Keep in mind....  just because you may get lots of digits back, it doesn't actually mean they are accurate.   My guess is there is not a system that you are likely to be working on that is going to give you anything close to nanosecond accuracy ( no matter how many digits you are given ).

Dan   
www.dtware.com

RE: Get time in nanoseconds with Fortran code???

There is no FORTRAN function which could give ns accuracy
unless you have several GHz clock and welldesigned special
hardware.

<nbucska@pcperipherals.com>

RE: Get time in nanoseconds with Fortran code???

ONK,

   If you look up "timer" code through google maybe adding Borland, they have a true microsecond routine and can't remember but I think also nanosecond timer in C code.  Looking though these functions, you will be able to see how the code works down at the hardware level and actually changes a few things around to make the ubiquotous PC offhand clock rate work precisely.  If you are still in need of the source code email me at: wswain@hippag.com and when I get to work I can send you the C code files.  Unfortunately, we have been off fortran for quite some time now so porting the code back may be left to you.  

Another thought, look up IRIG time generator on Google as there may be some Fortran code out there for free (maybe?) that meets the IRIG time standard.  This may be only to the 10th of a milllisecond or 100 nanosecond resolution.

Good Luck,
Bill

RE: Get time in nanoseconds with Fortran code???

In DOS you can use the internal timer running at 1.1938 MHz

<nbucska@pcperipherals.com>

RE: Get time in nanoseconds with Fortran code???

You can't get nanosec. accuracy with PC for the refresh.

<nbucska@pcperipherals.com>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close