Path: | src/dcdatetime.f90 |
Last Update: | Thu Sep 08 22:21:49 JST 2005 |
Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
* Developers: Eizi TOYODA (toyoda), Yasuhiro MORIKAWA (morikawa) * Version: $Id: dcdatetime.f90,v 1.2 2005/08/04 16:10:44 morikawa Exp $ * Tag Name: $Name: $ * Change History:
result : | type(DC_DATETIME) |
mon : | integer(INTK), intent(in) |
day : | integer(INTK), intent(in) |
sec : | real(DP), intent(in) |
type(DC_DATETIME) function DCDateTime(mon, day, sec) result(result) implicit none integer(INTK), intent(in):: mon, day real(DP), intent(in):: sec integer(INTK):: iday, month, year, century integer(INTK), parameter:: four_years = 365 * 4 + 1 continue iday = day + floor(sec / 86400.0_DP) result % sec = modulo(sec, 86400.0_DP) if (caltype == CAL_CYCLIC) then result % day = iday + mon * cyclic_mdays return endif month = modulo(mon - 3, 12) + 3 year = (mon - month) / 12 iday = iday + (month * 306 - 914) / 10 if (caltype == CAL_NOLEAP) then result % day = iday + year * 365 + month + 90 else iday = iday + (year * four_years - modulo(year * four_years, 4)) / 4 if (caltype == CAL_JULIAN .or. iday < 640116) then result % day = iday + 91 else century = (year - modulo(year, 100)) / 100 + 1 result % day = iday - (century * 3 - modulo(century * 3, 4)) / 4 + 93 endif endif end function