Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
idate_f90.c
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2.1 of the GNU Lesser General Public License 
00007   as published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU Lesser General Public 
00021   License along with this program; if not, write the Free Software 
00022   Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 
00023   USA.
00024 
00025   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00026   Mountain View, CA 94043, or:
00027 
00028   http://www.sgi.com
00029 
00030   For further information regarding this notice, see:
00031 
00032   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00033 
00034 */
00035 
00036 
00037 #pragma ident "@(#) libfi/element/idate_f90.c   92.2    06/16/99 15:47:23"
00038 #include <fortran.h>
00039 #include <sys/types.h>
00040 #include <time.h>
00041 
00042 /*
00043  * IDATE returns date in numerical form:
00044  *
00045  *      integer month, day, year
00046  *      call IDATE(month, day, year)
00047  *
00048  * where:
00049  *      month will receive the current month, day the current
00050  *      day, and year the current year modulo 100.
00051  *      Year will be not be a four-digit year since it is the
00052  *      year since 1900 
00053  *
00054  * or an older form:
00055  *
00056  *      integer iarray(3)
00057  *      call IDATE(iarray)
00058  *
00059  * where:
00060  *      iarray will receive the current date; day, mon, year.
00061  *      The year will be a four-digit year, i.e., the year
00062  *      since 1900 will have 1900 added.
00063  *
00064  */
00065 
00066 /* Use time() and localtime() to get the fields for idate */
00067 #define __IDATE_SCALAR()                                \
00068         struct tm       *locltm;                        \
00069         time_t          t;                              \
00070         t       = time(0);                              \
00071         locltm  = localtime(&t);                        \
00072         *imon   = locltm->tm_mon + 1;                   \
00073         *jday   = locltm->tm_mday;                      \
00074         *kyear  = locltm->tm_year % 100;
00075 
00076 #define __IDATE_ARRAY()                                 \
00077         struct tm       *locltm;                        \
00078         time_t          t;                              \
00079         t       = time(0);                              \
00080         locltm  = localtime(&t);                        \
00081         iarray[0]       = locltm->tm_mday;              \
00082         iarray[1]       = locltm->tm_mon + 1;           \
00083         iarray[2]       = locltm->tm_year + 1900;
00084 
00085 /* Note that the year is not four digits, i.e., year since 1900 in
00086  * localtime() % 100. The order of the scalar arguments is month,
00087  * day, and year.
00088  */
00089 extern void _IDATE_I(int *imon, int *jday, int *kyear)
00090 {
00091         __IDATE_SCALAR();
00092 }
00093 
00094 extern void _IDATE_I1(_f_int1 *imon, _f_int1 *jday, _f_int1 *kyear)
00095 {
00096         __IDATE_SCALAR();
00097 }
00098 
00099 extern void _IDATE_I2(_f_int2 *imon, _f_int2 *jday, _f_int2 *kyear)
00100 {
00101         __IDATE_SCALAR();
00102 }
00103 
00104 extern void _IDATE_I4(_f_int4 *imon, _f_int4 *jday, _f_int4 *kyear)
00105 {
00106         __IDATE_SCALAR();
00107 }
00108 
00109 extern void _IDATE_I8(_f_int8 *imon, _f_int8 *jday, _f_int8 *kyear)
00110 {
00111         __IDATE_SCALAR();
00112 }
00113 
00114 /* On IRIX, f77 with an array returns the order as day, month, and
00115  * year rather than month, day, year.  The year is four digits.
00116  */
00117 extern void _IDATE_A(int iarray[3])
00118 {
00119         __IDATE_ARRAY();
00120 }
00121 
00122 extern void _IDATE_A1(_f_int1 iarray[3])
00123 {
00124         __IDATE_ARRAY();
00125 }
00126 
00127 extern void _IDATE_A2(_f_int2 iarray[3])
00128 {
00129         __IDATE_ARRAY();
00130 }
00131 
00132 extern void _IDATE_A4(_f_int4 iarray[3])
00133 {
00134         __IDATE_ARRAY();
00135 }
00136 
00137 extern void _IDATE_A8(_f_int8 iarray[3])
00138 {
00139         __IDATE_ARRAY();
00140 }
00141 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines