Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Help and JTIME

JohnNichols
Valued Contributor III
1,207 Views

Steve:

I posted this incorrectly in the MK Forum, sorry.

I wanted to use the JTIME routine in the IFPORT Library.

Your help files has it as a function, but it now appears to be a called subroutine.

Your

results = Jtime()

returns an error on compile

call Jtime(results)

works fine.

Just letting you know.


The help viewer when trying to call up the Fortran Help Files crashes a lot. I have VS upto date and latest Fortran.

When Help Viewer works it is great, but it is a bit weird with the crashes.

JMN

0 Kudos
13 Replies
TimP
Honored Contributor III
1,207 Views
The compiler should throw a compile error on an empty argument for a function without explicit interface. USE IFPORT would provide the interfaces for functions in that library. One would think that a standard Fortran intrinsic would be preferable to an equivalent ifport legacy function.
0 Kudos
JohnNichols
Valued Contributor III
1,207 Views

USE IFPORT

INTEGER(4) int_time

character*8 char_time

int_time = TIME( )

call TIME(char_time)

print *, 'Integer: ', int_time, 'time: ', char_time

END

Parent topic:

T to Z

This is similar in my book and from your current help manual. I do not have the code here to try it, but I will try it tonight. int_time was called results in JTIME and it did not compile. Nor did the JTIME help section give this option : call JTIME(char_time), I just struck it by trial and error.

So I am a bit lost, as to which function to use, if the other is preferred from IFport, can the help reflect that in JTIME.

JTIME no longer comes up in your help manual if I search for it, is that because it is obsolete?

Regards

JMN
0 Kudos
JohnNichols
Valued Contributor III
1,207 Views

USE IFPORT

INTEGER(4) int_time

character*8 char_time

int_time = TIME( )

call TIME(char_time)

print *, 'Integer: ', int_time, 'time: ', char_time

END

Parent topic:

T to Z

This is similar in my book and from your current help manual. I do not have the code here to try it, but I will try it tonight. int_time was called results in JTIME and it did not compile. Nor did the JTIME help section give this option : call JTIME(char_time), I just struck it by trial and error.

So I am a bit lost, as to which function to use, if the other is preferred from IFport, can the help reflect that in JTIME.

JTIME no longer comes up in your help manual if I search for it, is that because it is obsolete?

Regards

JMN
0 Kudos
JohnNichols
Valued Contributor III
1,207 Views
0 Kudos
Anonymous66
Valued Contributor I
1,207 Views
The ifport version of JDATE is working

The program below compiles and prints out the correct JDATE.

[fortran]program main
USE IFPORT

character*8 a_jdate

a_jdate = JDATE( )

print *, 'JDATE for Today: ', a_jdate
END
[/fortran]
0 Kudos
JohnNichols
Valued Contributor III
1,207 Views

One of the problems of working on projects over a long time is you can get lost. Plus working on a computer at home and then using the work computer for talking on this site.

I need the year as 2012 not 12.

your code works fine if I accept the 12 as the year, but in my printout I was looking for 2012. This requires JDATE4. This code below generates an error on the jdate4, that is eliminated with a call statement.
Your help shows jdate4 as below, I just checked the latest help. But it gives this error:
Error 1 error #6553: A function reference is invoking a subroutine subprogram. [JDATE4] b:\john\documents\visual studio 2010\Projects\Console2\Console2\Console2.f90 20
My comment is about the error in the help file for JDATE4, sorry I got the code mixed up.

[bash]program main   
   USE IFPORT   
   character*8 a_jdate
   character*10 b_jdate  
   a_jdate = JDATE( )   
   b_jdate = jdate4() 
   print *, 'JDATE for Today: ', a_jdate, b_jdate  
   END  

[/bash]
0 Kudos
Anonymous66
Valued Contributor I
1,207 Views
Thanks for the reproducer. I have escalated this issue to development.

The issue number is #DPD200177877.

Regards,
Annalee
0 Kudos
Steven_L_Intel1
Employee
1,207 Views
I strongly suggest using the standard DATE_AND_TIME intrinsic.
0 Kudos
JohnNichols
Valued Contributor III
1,207 Views
Steve:

I normally do use the date and time intrinsic. This is the first time I have used the Julian Date, but for this program I wanted the Julian date so I can track the created files easily. There is no argument that 36 th day is in February, but 2/11 could be 2 Nov or 11 Feb depending on your location.

Regards

JMN
0 Kudos
Paul_Curtis
Valued Contributor I
1,207 Views
Whatever JDATE() is, it has absolutely nothing to do with the correct Julian date. The Julian date is a representation of the Julian calendar which assigns a unique integer, in unitary progression, to each day; it is not a cobbled-together psuedo-integer with digits in preselected positions representing different components of the overall datestamp.

The point of using Julian dates is 1) concision, as each Julian can be represented in a 4-byte integer, and 2) direct interval arithmetic, as the day span between any two dates is the simple difference of their Julian representations.

Here are forward and reverse routines for moving between Julian dates and ymd:

[bash]FUNCTION julian_date (yyyy, mm, dd) RESULT (julian)
	IMPLICIT NONE
	!          converts calendar date to Julian date
	!          cf Fliegel & Van Flandern, CACM 11(10):657, 1968
	!          example: julian_date(1970,1,1)=2440588
	INTEGER,INTENT(IN)           :: yyyy,mm,dd
	INTEGER                      :: julian
	julian = dd - 32075 + 1461*(yyyy + 4800 + (mm - 14)/12)/4 +  &
			 367*(mm - 2 - ((mm - 14)/12)*12)/12 -               &
			 3*((yyyy + 4900 + (mm - 14)/12)/100)/4
END FUNCTION julian_date


SUBROUTINE get_ymd (jd, yyyy, mm, dd)
	IMPLICIT NONE
	!          expands a Julian date into a calendar date
	!          cf Fliegel & Van Flandern, CACM 11(10):657, 1968
	INTEGER,INTENT(IN)           :: jd
	INTEGER,INTENT(OUT)          :: yyyy,mm,dd
	INTEGER                      :: l,n
	l		= jd + 68569
	n		= 4*l/146097
	l		= l - (146097*n + 3)/4
	yyyy	= 4000*(l + 1)/1461001
	l		= l - 1461*yyyy/4 + 31
	mm		= 80*l/2447
	dd		= l - 2447*mm/80
	l		= mm/11
	mm		= mm + 2 - 12*l
	yyyy	= 100*(n - 49) + yyyy + l
END SUBROUTINE get_ymd
[/bash]


0 Kudos
Anonymous66
Valued Contributor I
1,207 Views
Hi John,

You can work around this issue for now by excluding the JDATE4 interface from IFPORT and declaring your own interface for JDATE4 as a function.

To exclude JDATE4, change the use statement to:

USE IFPORT, UNUSED=>JDATE4
0 Kudos
Anonymous66
Valued Contributor I
1,207 Views
We are currently planning to change jdate4 so that is matches the documentation in the next major release.
0 Kudos
Anonymous66
Valued Contributor I
1,207 Views
This is issue has been fixed in Intel® Visual Fortran Composer XE for Windows* 2013 which is now available at the Intel® Registration Center. Regards, Annalee Intel Developer Support * Other names and brands may be claimed as the property of others.
0 Kudos
Reply