<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — A simple clock timer]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=217&amp;type=atom" />
	<updated>2013-06-25T11:27:34Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=217</id>
		<entry>
			<title type="html"><![CDATA[Re: A simple clock timer]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=847#p847" />
			<content type="html"><![CDATA[<p>The problem you&#039;re encountering is that the timer intrinsic procedures are only available in Fortran 90 and higher.&nbsp; If you set the compiler to enforce the legacy standard, Fortran 77, the compiler specifically disallows these intrinsics.&nbsp; The Fortran 77 standard doesn&#039;t provide or specify any way to do what you&#039;re asking except, perhaps, via a custom, 3rd party, system-dependent library.</p><p>I would suggest using the <em>CPU_TIME</em> intrinsic with your fixed-format (Fortran-77-style) source code.&nbsp; While it isn&#039;t part of the Fortran 77 standard, it is at least part of later standards.&nbsp; If you need to port your code to other compilers, the <em>CPU_TIME</em> intrinsic will be supported by other compilers if they allow you to use Fortran 90+ intrinsics with fixed-format source code (almost every one will).&nbsp; The use of <em>SECNDS</em> is discouraged simply because it is a GNU Fortran extension, and it may not be supported by other compilers.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2013-06-25T11:27:34Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=847#p847</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: A simple clock timer]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=846#p846" />
			<content type="html"><![CDATA[<p>Yes, so it works in F90+ programs but when I plug it into an F77 program it doesn&#039;t.<br />If I compile the F77 program without the compiler flag -std=legacy it compiles OK, but I&#039;m worried this may lead to other problems.<br />So I guess the question is:<br />What is the equivalent F77 code? Or where can I find another simple clock (not CPU) timer in F77?</p>]]></content>
			<author>
				<name><![CDATA[francob]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3410</uri>
			</author>
			<updated>2013-06-25T09:18:46Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=846#p846</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: A simple clock timer]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=845#p845" />
			<content type="html"><![CDATA[<p>I&#039;m not sure I understand the problem you&#039;re experiencing.&nbsp; The code you posted is obviously Fortran 90+ code.&nbsp; When you say you&#039;re receiving the error in Fortran 77, are you using code modified to be in fixed-format?</p><p>I should also point out that the <em>SECNDS</em> intrinsic is a GNU extension who&#039;s use is discouraged.&nbsp; I would suggest looking instead at using the <a href="http://gcc.gnu.org/onlinedocs/gfortran/CPU_005fTIME.html#CPU_005fTIME"><em>CPU_TIME</em> intrinsic procedure</a>, which is part of the Fortran 95 standard.&nbsp; That way you&#039;ll ensure code portability.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2013-06-24T12:15:39Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=845#p845</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[A simple clock timer]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=844#p844" />
			<content type="html"><![CDATA[<p>The following works well in Fortran 95:<br />!Timer variables<br />real(4)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:: time1, time2<br />!Start timer<br />time1=secnds(0.0) <br />(do stuff)<br />! Stop timer and write<br />time2=secnds(time1)<br />WRITE (*,&#039;(A,F8.2)&#039;)&nbsp; &nbsp; &nbsp;&quot;Time (sec):&quot;, time2 </p><p>But in Fortran 77 I get these error messages:<br />&nbsp; &nbsp; &nbsp;time1=secnds(0.0)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp;1<br />Error: Syntax error in DATA statement at (1)</p><p>&nbsp; &nbsp; &nbsp; time2=secnds(time1)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1<br />Error: &#039;x&#039; argument of &#039;secnds&#039; intrinsic at (1) must be of kind 4</p><p>Any ideas?</p>]]></content>
			<author>
				<name><![CDATA[francob]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3410</uri>
			</author>
			<updated>2013-06-24T11:36:29Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=844#p844</id>
		</entry>
</feed>
