c
c
c     ###################################################
c     ##  COPYRIGHT (C)  1993  by  Jay William Ponder  ##
c     ##              All Rights Reserved              ##
c     ###################################################
c
c     ###############################################################
c     ##                                                           ##
c     ##  subroutine calendar  --  find the current date and time  ##
c     ##                                                           ##
c     ###############################################################
c
c
c     "calendar" returns the current time as a set of integer
c     values representing the year, month, day, hour, minute
c     and second; only one of the various machine implementations
c     included should be activated by removing comment characters
c
c
      subroutine calendar (year,month,day,hour,minute,second)
      implicit none
      integer year,month,day
      integer hour,minute,second
c
c
c     Unix machines use the "itime" and "idate" intrinsics,
c     this code works for Sun, DEC, SGI, Convex and others
c
c     integer hms(3)
c     call itime (hms)
c     hour = hms(1)
c     minute = hms(2)
c     second = hms(3)
c     call idate (month,day,year)
c
c     code for IBM RS/6000 under AIX appends an underscore
c
      integer hms(3)
      call itime_(hms)
      hour = hms(1)
      minute = hms(2)
      second = hms(3)
      call idate_(month,day,year)
c
c     code for Hewlett-Packard systems under HP-UX, Digital OpenVMS,
c     and Apple Macintosh under Language Systems Fortran compiler;
c     for HP machines the +E1 compiler option is also required
c
c     real secnds
c     second = int(secnds(0.0))
c     hour = mod(second,3600)
c     second = second - 3600*hour
c     minute = mod(second,60)
c     second = second - 60*minute
c     call idate (month,day,year)
c
c     Intel-based PC's under the Microsoft and Watcom compilers
c
c     integer*2 hrs,mins,secs,hsecs
c     integer*2 yrs,mons,days
c     call gettim (hrs,mins,secs,hsecs)
c     hour = hrs
c     minute = mins
c     second = secs
c     call getdat (yrs,mons,days)
c     year = yrs
c     month = mons
c     day = days
      return
      end
