libsim Versione 7.2.6
|
◆ datetime_new()
Initialize a datetime object according to the provided arguments If no arguments are passed a missing object is created. Notice that the optional parameter groups (year, month, hour, minute, msec), (unixtime), (isodate), (simpledate) are mutually exclusive, the results are not guaranteed if arguments of different groups are present.
Definizione alla linea 714 del file datetime_class.F90. 716 res = .true.
717ELSE IF (this > that) THEN
718 res = .true.
719ELSE
720 res = .false.
721ENDIF
722
723END FUNCTION datetime_ge
724
725
726ELEMENTAL FUNCTION datetime_le(this, that) RESULT(res)
727TYPE(datetime),INTENT(IN) :: this, that
728LOGICAL :: res
729
730IF (this == that) THEN
731 res = .true.
732ELSE IF (this < that) THEN
733 res = .true.
734ELSE
735 res = .false.
736ENDIF
737
738END FUNCTION datetime_le
739
740
741FUNCTION datetime_add(this, that) RESULT(res)
742TYPE(datetime),INTENT(IN) :: this
743TYPE(timedelta),INTENT(IN) :: that
744TYPE(datetime) :: res
745
746INTEGER :: lyear, lmonth, lday, lhour, lminute, lmsec
747
748IF (this == datetime_miss .OR. that == timedelta_miss) THEN
749 res = datetime_miss
750ELSE
751 res%iminuti = this%iminuti + that%iminuti
752 IF (that%month /= 0) THEN
753 CALL getval(res, year=lyear, month=lmonth, day=lday, hour=lhour, &
754 minute=lminute, msec=lmsec)
755 CALL init(res, year=lyear, month=lmonth+that%month, day=lday, &
756 hour=lhour, minute=lminute, msec=lmsec)
757 ENDIF
758ENDIF
759
760END FUNCTION datetime_add
761
762
763ELEMENTAL FUNCTION datetime_subdt(this, that) RESULT(res)
764TYPE(datetime),INTENT(IN) :: this, that
765TYPE(timedelta) :: res
766
767IF (this == datetime_miss .OR. that == datetime_miss) THEN
768 res = timedelta_miss
769ELSE
770 res%iminuti = this%iminuti - that%iminuti
771 res%month = 0
772ENDIF
773
774END FUNCTION datetime_subdt
775
776
777FUNCTION datetime_subtd(this, that) RESULT(res)
778TYPE(datetime),INTENT(IN) :: this
779TYPE(timedelta),INTENT(IN) :: that
780TYPE(datetime) :: res
781
782INTEGER :: lyear, lmonth, lday, lhour, lminute, lmsec
783
784IF (this == datetime_miss .OR. that == timedelta_miss) THEN
785 res = datetime_miss
786ELSE
787 res%iminuti = this%iminuti - that%iminuti
788 IF (that%month /= 0) THEN
789 CALL getval(res, year=lyear, month=lmonth, day=lday, hour=lhour, &
790 minute=lminute, msec=lmsec)
791 CALL init(res, year=lyear, month=lmonth-that%month, day=lday, &
792 hour=lhour, minute=lminute, msec=lmsec)
793 ENDIF
794ENDIF
795
796END FUNCTION datetime_subtd
797
798
799!> This method reads from a Fortran file unit the contents of the
800!! object \a this. The record to be read must have been written with
801!! the ::write_unit method. The method works both on formatted and
802!! unformatted files.
803SUBROUTINE datetime_read_unit(this, unit)
804TYPE(datetime),INTENT(out) :: this !< object to be read
805INTEGER, INTENT(in) :: unit !< unit from which to read, it must be an opened Fortran file unit
806CALL datetime_vect_read_unit((/this/), unit)
807
808END SUBROUTINE datetime_read_unit
809
810
|