Index: /palm/trunk/SOURCE/Makefile
===================================================================
--- /palm/trunk/SOURCE/Makefile	(revision 4226)
+++ /palm/trunk/SOURCE/Makefile	(revision 4227)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Add palm_date_time_mod, remove date_and_time_mod
+#
+# 4223 2019-09-10 09:20:47Z gronemeier
 # Corrected "Former revisions" section
 # 
@@ -138,5 +141,4 @@
 	data_output_spectra.f90 \
 	data_output_tseries.f90 \
-	date_and_time_mod.f90 \
 	diagnostic_output_quantities_mod.f90 \
 	diffusion_s.f90 \
@@ -187,4 +189,5 @@
 	outflow_turbulence.f90 \
 	palm.f90 \
+	palm_date_time_mod.f90 \
 	parin.f90 \
 	plant_canopy_model_mod.f90 \
@@ -324,8 +327,8 @@
 biometeorology_mod.o: \
 	basic_constants_and_equations_mod.o \
-	date_and_time_mod.o \
-	modules.o \
-	mod_kinds.o \
-	netcdf_data_input_mod.o \
+	modules.o \
+	mod_kinds.o \
+	netcdf_data_input_mod.o \
+	palm_date_time_mod.o \
 	radiation_model_mod.o
 boundary_conds.o: \
@@ -381,8 +384,8 @@
 	chem_gasphase_mod.o \
 	chem_modules.o \
-	date_and_time_mod.o \
-	mod_kinds.o \
-	modules.o \
-	netcdf_data_input_mod.o \
+	mod_kinds.o \
+	modules.o \
+	netcdf_data_input_mod.o \
+	palm_date_time_mod.o \
 	surface_mod.o
 chemistry_model_mod.o: \
@@ -392,9 +395,9 @@
 	chem_modules.o \
 	chem_photolysis_mod.o \
-	date_and_time_mod.o \
 	diffusion_s.o \
 	mod_kinds.o \
 	modules.o \
 	netcdf_data_input_mod.o \
+	palm_date_time_mod.o \
 	radiation_model_mod.o \
 	surface_mod.o
@@ -411,4 +414,5 @@
 	mod_kinds.o \
 	modules.o \
+	palm_date_time_mod.o \
 	radiation_model_mod.o
 close_file.o: \
@@ -503,7 +507,4 @@
 	radiation_model_mod.o \
 	urban_surface_mod.o
-date_and_time_mod.o: \
-	mod_kinds.o \
-	modules.o
 diagnostic_output_quantities_mod.o: \
 	mod_kinds.o \
@@ -578,5 +579,4 @@
 	bulk_cloud_model_mod.o \
 	cpulog_mod.o \
-	date_and_time_mod.o \
 	model_1d_mod.o \
 	module_interface.o \
@@ -585,4 +585,5 @@
 	netcdf_interface_mod.o \
 	ocean_mod.o \
+	palm_date_time_mod.o \
 	plant_canopy_model_mod.o \
 	pmc_handle_communicator_mod.o \
@@ -592,8 +593,8 @@
 indoor_model_mod.o: \
 	cpulog_mod.o \
-	date_and_time_mod.o \
-	mod_kinds.o \
-	modules.o \
-	netcdf_data_input_mod.o \
+	mod_kinds.o \
+	modules.o \
+	netcdf_data_input_mod.o \
+	palm_date_time_mod.o \
 	surface_mod.o \
 	urban_surface_mod.o
@@ -621,4 +622,5 @@
 	random_generator_parallel_mod.o \
 	read_restart_data_mod.o \
+	palm_date_time_mod.o \
 	surface_layer_fluxes_mod.o \
 	surface_mod.o \
@@ -779,4 +781,5 @@
 	netcdf_data_input_mod.o \
 	ocean_mod.o \
+	palm_date_time_mod.o \
 	radiation_model_mod.o \
 	salsa_mod.o \
@@ -810,5 +813,4 @@
 	chem_photolysis_mod.o \
 	cpulog_mod.o \
-	date_and_time_mod.o \
 	diagnostic_output_quantities_mod.o \
 	land_surface_model_mod.o \
@@ -825,8 +827,10 @@
 	time_to_string.o \
 	write_restart_data_mod.o
+palm_date_time_mod.o: \
+	mod_kinds.o \
+	modules.o
 parin.o: \
 	chem_modules.o \
 	cpulog_mod.o \
-	date_and_time_mod.o \
 	model_1d_mod.o \
 	mod_kinds.o \
@@ -952,8 +956,8 @@
 	bulk_cloud_model_mod.o \
 	calc_mean_profile.o \
-	date_and_time_mod.o \
 	mod_particle_attributes.o \
 	modules.o \
 	netcdf_data_input_mod.o \
+	palm_date_time_mod.o \
 	plant_canopy_model_mod.o \
 	surface_mod.o
@@ -970,5 +974,4 @@
 	chem_modules.o \
 	cpulog_mod.o \
-	date_and_time_mod.o \
 	diagnostic_output_quantities_mod.o \
 	mod_kinds.o \
@@ -977,4 +980,5 @@
 	modules.o \
 	netcdf_interface_mod.o \
+	palm_date_time_mod.o \
 	radiation_model_mod.o \
 	random_function_mod.o\
@@ -998,4 +1002,5 @@
 	diffusion_s.o \
 	netcdf_data_input_mod.o \
+	palm_date_time_mod.o \
 	plant_canopy_model_mod.o \
 	surface_mod.o \
@@ -1086,4 +1091,5 @@
 	nesting_offl_mod.o \
 	ocean_mod.o \
+	palm_date_time_mod.o \
 	pmc_interface_mod.o \
 	prognostic_equations.o \
@@ -1105,8 +1111,8 @@
 	basic_constants_and_equations_mod.o \
 	cpulog_mod.o \
-	date_and_time_mod.o \
 	land_surface_model_mod.o \
 	mod_kinds.o \
 	modules.o \
+	palm_date_time_mod.o \
 	pmc_interface_mod.o \
 	radiation_model_mod.o \
@@ -1152,8 +1158,8 @@
 urban_surface_mod.o: \
 	basic_constants_and_equations_mod.o \
-	date_and_time_mod.o \
-	mod_kinds.o \
-	modules.o \
-	netcdf_data_input_mod.o \
+	mod_kinds.o \
+	modules.o \
+	netcdf_data_input_mod.o \
+	palm_date_time_mod.o \
 	radiation_model_mod.o \
 	surface_mod.o
@@ -1253,5 +1259,4 @@
 	mod_kinds.o
 write_restart_data_mod.o: \
-	date_and_time_mod.o \
 	mod_kinds.o \
 	model_1d_mod.o \
@@ -1259,4 +1264,5 @@
 	modules.o \
 	netcdf_interface_mod.o \
+	palm_date_time_mod.o \
 	radiation_model_mod.o \
 	random_function_mod.o \
Index: /palm/trunk/SOURCE/biometeorology_mod.f90
===================================================================
--- /palm/trunk/SOURCE/biometeorology_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/biometeorology_mod.f90	(revision 4227)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4223 2019-09-10 09:20:47Z gronemeier
 ! Corrected "Former revisions" section
 ! 
@@ -140,7 +143,4 @@
                surface_pressure
 
-    USE date_and_time_mod,                                                     &
-        ONLY:  calc_date_and_time, day_of_year, time_utc
-
     USE grid_variables,                                                        &
         ONLY:  ddx, dx, ddy, dy
@@ -155,4 +155,7 @@
         ONLY:  netcdf_data_input_uvem, uvem_projarea_f, uvem_radiance_f,       &
                uvem_irradiance_f, uvem_integration_f, building_obstruction_f
+
+    USE palm_date_time_mod,                                                    &
+        ONLY:  get_date_time
 !
 !-- Import radiation model to obtain input for mean radiant temperature
@@ -4226,36 +4229,34 @@
 !-- UVEM specific subroutines
 
-!---------------------------------------------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Module-specific routine for new module
-!---------------------------------------------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE uvem_solar_position
-    
-    USE date_and_time_mod,                                                                                            &
-       ONLY:  calc_date_and_time, day_of_year, time_utc 
-    
-    USE control_parameters,                                                                                           &
-       ONLY:  latitude, longitude   
+
+    USE control_parameters,                                                                        &
+       ONLY:  latitude, longitude, time_since_reference_point
 
     IMPLICIT NONE
-    
-   
-    REAL(wp) ::  alpha       = 0.0_wp   !< solar azimuth angle in radiant    
-    REAL(wp) ::  doy_r       = 0.0_wp   !< real format of day_of_year           
-    REAL(wp) ::  declination = 0.0_wp   !< declination
-    REAL(wp) ::  dtor        = 0.0_wp   !< factor to convert degree to radiant
-    REAL(wp) ::  js          = 0.0_wp   !< parameter for solar position calculation
-    REAL(wp) ::  lat         = 52.39_wp !< latitude
-    REAL(wp) ::  lon         = 9.7_wp   !< longitude        
-    REAL(wp) ::  thetar      = 0.0_wp   !< angle for solar zenith angle calculation
-    REAL(wp) ::  thetasr     = 0.0_wp   !< angle for solar azimuth angle calculation    
-    REAL(wp) ::  zgl         = 0.0_wp   !< calculated exposure by direct beam   
-    REAL(wp) ::  woz         = 0.0_wp   !< calculated exposure by diffuse radiation
-    REAL(wp) ::  wsp         = 0.0_wp   !< calculated exposure by direct beam   
-   
-
-    CALL calc_date_and_time
-    doy_r = real(day_of_year)   
+
+    INTEGER(iwp) ::  day_of_year = 0       !< day of year
+
+    REAL(wp) ::  alpha         = 0.0_wp    !< solar azimuth angle in radiant    
+    REAL(wp) ::  declination   = 0.0_wp    !< declination
+    REAL(wp) ::  dtor          = 0.0_wp    !< factor to convert degree to radiant
+    REAL(wp) ::  js            = 0.0_wp    !< parameter for solar position calculation
+    REAL(wp) ::  lat           = 52.39_wp  !< latitude
+    REAL(wp) ::  lon           = 9.7_wp    !< longitude
+    REAL(wp) ::  second_of_day = 0.0_wp    !< current second of the day
+    REAL(wp) ::  thetar        = 0.0_wp    !< angle for solar zenith angle calculation
+    REAL(wp) ::  thetasr       = 0.0_wp    !< angle for solar azimuth angle calculation    
+    REAL(wp) ::  zgl           = 0.0_wp    !< calculated exposure by direct beam   
+    REAL(wp) ::  woz           = 0.0_wp    !< calculated exposure by diffuse radiation
+    REAL(wp) ::  wsp           = 0.0_wp    !< calculated exposure by direct beam   
+
+
+    CALL get_date_time( time_since_reference_point, &
+                        day_of_year = day_of_year, second_of_day = second_of_day )
     dtor = pi / 180.0_wp
     lat = latitude
@@ -4263,5 +4264,5 @@
 !
 !-- calculation of js, necessary for calculation of equation of time (zgl) :
-    js=  72.0_wp * ( doy_r + ( time_utc / 86400.0_wp ) ) / 73.0_wp 
+    js=  72.0_wp * ( REAL( day_of_year, KIND=wp ) + ( second_of_day / 86400.0_wp ) ) / 73.0_wp 
 !
 !-- calculation of equation of time (zgl):
@@ -4270,5 +4271,5 @@
 !
 !-- calculation of apparent solar time woz:
-    woz = ( ( time_utc / 3600.0_wp ) - ( 4.0_wp * ( 15.0_wp - lon ) ) / 60.0_wp ) + ( zgl / 60.0_wp )
+    woz = ( ( second_of_day / 3600.0_wp ) - ( 4.0_wp * ( 15.0_wp - lon ) ) / 60.0_wp ) + ( zgl / 60.0_wp )
 !
 !-- calculation of hour angle (wsp):
Index: /palm/trunk/SOURCE/chem_emissions_mod.f90
===================================================================
--- /palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/chem_emissions_mod.f90	(revision 4227)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4223 2019-09-10 09:20:47Z gronemeier
 ! Unused routine chem_emissions_check_parameters commented out due to uninitialized content
 ! 
@@ -118,10 +121,4 @@
         ONLY: chem_emis_att_type, chem_emis_val_type
 
-    USE date_and_time_mod,                                                   &
-        ONLY: day_of_month, hour_of_day,                                     &
-             index_mm, index_dd, index_hh,                                   &
-             month_of_year, hour_of_day,                                     &
-             time_default_indices, time_preprocessed_indices
-    
     USE chem_gasphase_mod,                                                   &
         ONLY: nvar, spc_names
@@ -905,5 +902,9 @@
 ! Description:
 ! ------------
-!> Routine for Update of Emission values at each timestep 
+!> Routine for Update of Emission values at each timestep.
+!>
+!> @todo Clarify the correct usage of index_dd, index_hh and index_mm. Consider
+!>       renaming of these variables.
+!> @todo Clarify time used in emis_lod=2 mode. ATM, the used time seems strange.
 !-------------------------------------------------------------------------------!
 
@@ -919,4 +920,9 @@
        ONLY: hyp, pt 
 
+    USE control_parameters, &
+        ONLY: time_since_reference_point
+
+    USE palm_date_time_mod, &
+        ONLY: days_per_week, get_date_time, hours_per_day, months_per_year, seconds_per_day
    
  IMPLICIT NONE
@@ -940,8 +946,19 @@
     INTEGER(iwp) ::  m                                                          !< running index for horizontal surfaces
 
+    INTEGER(iwp) ::  day_of_month                                               !< day of the month
+    INTEGER(iwp) ::  day_of_week                                                !< day of the week
+    INTEGER(iwp) ::  day_of_year                                                !< day of the year
+    INTEGER(iwp) ::  days_since_reference_point                                 !< days since reference point
+    INTEGER(iwp) ::  hour_of_day                                                !< hour of the day
+    INTEGER(iwp) ::  month_of_year                                              !< month of the year
+    INTEGER(iwp) ::  index_dd                                                   !< index day
+    INTEGER(iwp) ::  index_hh                                                   !< index hour
+    INTEGER(iwp) ::  index_mm                                                   !< index month
+
+    REAL(wp) ::  time_utc_init                                                  !< second of day of initial date
+
     !
     !-- CONVERSION FACTORS: TIME  
     REAL(wp), PARAMETER ::  hour_per_year =  8760.0_wp  !< number of hours in a year of 365 days  
-    REAL(wp), PARAMETER ::  hour_per_day  =    24.0_wp  !< number of hours in a day
     REAL(wp), PARAMETER ::  s_per_hour    =  3600.0_wp  !< number of sec per hour (s)/(hour)    
     REAL(wp), PARAMETER ::  s_per_day     = 86400.0_wp  !< number of sec per day (s)/(day)  
@@ -1073,6 +1090,11 @@
 !-- Update time indices
 
-          CALL time_preprocessed_indices( index_hh )
-
+          CALL get_date_time( 0.0_wp, second_of_day=time_utc_init )
+          CALL get_date_time( time_since_reference_point, hour=hour_of_day )
+
+          days_since_reference_point = INT( FLOOR( ( time_utc_init + time_since_reference_point ) &
+                                                   / seconds_per_day ) )
+
+          index_hh = days_since_reference_point * hours_per_day + hour_of_day
 
 !
@@ -1102,5 +1124,7 @@
 !-- Update time indices
 
-             CALL time_default_indices( month_of_year, day_of_month, hour_of_day, index_hh )
+             CALL get_date_time( time_since_reference_point, &
+                                 day_of_year=day_of_year, hour=hour_of_day )
+             index_hh = ( day_of_year - 1_iwp ) * hour_of_day
 
 !
@@ -1132,7 +1156,23 @@
 !
 !-- Update time indices
-             CALL time_default_indices( daytype_mdh, month_of_year, day_of_month,  &
-                  hour_of_day, index_mm, index_dd,index_hh )
-
+             CALL get_date_time( time_since_reference_point, &
+                                 month=month_of_year,        &
+                                 day=day_of_month,           &
+                                 hour=hour_of_day,           &
+                                 day_of_week=day_of_week     )
+             index_mm = month_of_year
+             index_dd = months_per_year + day_of_week
+             SELECT CASE(TRIM(daytype_mdh))
+
+                CASE ("workday")
+                   index_hh = months_per_year + days_per_week + hour_of_day
+
+                CASE ("weekend")
+                   index_hh = months_per_year + days_per_week + hours_per_day + hour_of_day
+
+                CASE ("holiday")
+                   index_hh = months_per_year + days_per_week + 2*hours_per_day + hour_of_day
+
+             END SELECT
 !
 !-- Check if the index is less or equal to the temporal dimension of MDH emission files
@@ -1189,5 +1229,6 @@
 
 !
-!-- Get time-factor for specific hour
+!--       Get time-factor for specific hour
+          CALL get_date_time( time_since_reference_point, hour=hour_of_day )
 
           index_hh = hour_of_day
@@ -1196,5 +1237,5 @@
        ENDIF  ! emiss_lod
 
-       
+
 !
 !--  Emission distribution calculation
@@ -1257,5 +1298,5 @@
                                                  time_factor(icat) *           &
                                                  emt_att%nox_comp(icat,1) *    &
-                                                 conversion_factor * hour_per_day
+                                                 conversion_factor * hours_per_day
 
                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                &
@@ -1270,5 +1311,5 @@
                                                  time_factor(icat) *           &
                                                  emt_att%nox_comp(icat,2) *    &
-                                                 conversion_factor * hour_per_day
+                                                 conversion_factor * hours_per_day
 
                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                &
@@ -1283,5 +1324,5 @@
                                                  time_factor(icat) *           &
                                                  emt_att%sox_comp(icat,1) *    &
-                                                 conversion_factor * hour_per_day
+                                                 conversion_factor * hours_per_day
 
                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                &
@@ -1298,5 +1339,5 @@
                                                  time_factor(icat) *           &
                                                  emt_att%sox_comp(icat,2) *    &
-                                                 conversion_factor * hour_per_day
+                                                 conversion_factor * hours_per_day
 
                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                &
@@ -1315,5 +1356,5 @@
                                                     time_factor(icat) *                  &
                                                     emt_att%pm_comp(icat,i_pm_comp,1) *  &
-                                                    conversion_factor * hour_per_day 
+                                                    conversion_factor * hours_per_day 
 
                       emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                       &
@@ -1333,5 +1374,5 @@
                                                     time_factor(icat) *                  &
                                                     emt_att%pm_comp(icat,i_pm_comp,2) *  &
-                                                    conversion_factor * hour_per_day 
+                                                    conversion_factor * hours_per_day 
 
                       emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                       &
@@ -1351,5 +1392,5 @@
                                                     time_factor(icat)     *              &
                                                     emt_att%pm_comp(icat,i_pm_comp,3) *  &
-                                                    conversion_factor * hour_per_day 
+                                                    conversion_factor * hours_per_day 
 
                       emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                       &
@@ -1372,5 +1413,5 @@
                                                        time_factor(icat) *               &
                                                        emt_att%voc_comp(icat,match_spec_voc_input(ivoc)) *   &
-                                                       conversion_factor * hour_per_day
+                                                       conversion_factor * hours_per_day
 
                          emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                    &
@@ -1389,5 +1430,5 @@
                    delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) *                 &
                                                  time_factor(icat) *                     &
-                                                 conversion_factor * hour_per_day
+                                                 conversion_factor * hours_per_day
  
                    emis_distribution(1,nys:nyn,nxl:nxr,ispec) =                          &
Index: /palm/trunk/SOURCE/chem_photolysis_mod.f90
===================================================================
--- /palm/trunk/SOURCE/chem_photolysis_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/chem_photolysis_mod.f90	(revision 4227)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Change call to calc_zenith
+! 
+! 4223 2019-09-10 09:20:47Z gronemeier
 ! Corrected "Former revisions" section
 ! 
@@ -227,4 +230,7 @@
  SUBROUTINE photolysis_simple
 
+    USE palm_date_time_mod,                                                    &
+        ONLY:  get_date_time
+
     USE radiation_model_mod,                                                   &
         ONLY:  calc_zenith, cos_zenith
@@ -232,6 +238,10 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) :: iphot,iav !< loop indix for photolysis reaction
-    REAL(wp)     :: coszi     !< 1./cosine of zenith angle
+    INTEGER(iwp) :: day_of_year  !< day of the year
+    INTEGER(iwp) :: iav          !< loop indix for photolysis reaction
+    INTEGER(iwp) :: iphot        !< loop indix for photolysis reaction
+
+    REAL(wp)     :: coszi          !< 1./cosine of zenith angle
+    REAL(wp)     :: second_of_day  !< second of the day
 
     DO  iphot = 1, nphot
@@ -239,5 +249,7 @@
     ENDDO
 
-    CALL calc_zenith
+    CALL get_date_time( time_since_reference_point, &
+                        day_of_year=day_of_year, second_of_day=second_of_day )
+    CALL calc_zenith( day_of_year, second_of_day )
 
     IF ( cos_zenith > 0.0_wp ) THEN
Index: /palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4227)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -2996,11 +2999,12 @@
 
     USE control_parameters,                                                 &   
-         ONLY:  dt_3d, intermediate_timestep_count, latitude
+         ONLY:  dt_3d, intermediate_timestep_count, latitude,               &
+                time_since_reference_point
 
     USE arrays_3d,                                                          &
          ONLY:  dzw, rho_air_zw
 
-    USE date_and_time_mod,                                                  &
-         ONLY:  day_of_year
+    USE palm_date_time_mod,                                                 &
+         ONLY:  get_date_time
 
     USE surface_mod,                                                        &
@@ -3012,4 +3016,5 @@
 
 
+    INTEGER(iwp) ::  day_of_year                   !< current day of the year
     INTEGER(iwp), INTENT(IN) ::  i
     INTEGER(iwp), INTENT(IN) ::  j
@@ -3286,4 +3291,7 @@
          xm_O * 3 /)                                !< o3_biascorr
 !
+!-- Get current day of the year
+    CALL get_date_time( time_since_reference_point, day_of_year = day_of_year )
+!
 !-- Initialize surface element m
     m = 0
@@ -5849,3 +5857,2 @@
      
  END MODULE chemistry_model_mod
-
Index: lm/trunk/SOURCE/date_and_time_mod.f90
===================================================================
--- /palm/trunk/SOURCE/date_and_time_mod.f90	(revision 4226)
+++ 	(revision )
@@ -1,574 +1,0 @@
-!> @file date_and_time_mod.f90
-!------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2019 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! ------------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-! Corrected "Former revisions" section
-! 
-! 4144 2019-08-06 09:11:47Z raasch
-! relational operators .EQ., .NE., etc. replaced by ==, /=, etc.
-! 
-! 3839 2019-03-28 21:12:25Z moh.hefny
-! further tabs removed, unused variables removed
-! 
-! 3655 2019-01-07 16:51:22Z knoop
-! further tabs removed
-! 
-! 2544 2017-10-13 18:09:32Z maronga
-! Initial revision
-! 
-!
-! Description:
-! ------------
-!> This routine calculates all needed information on date and time used by
-!> other modules
-!> @todo Further testing and revision of routines for updating indices of 
-!>       emissions in the default mode 
-!> @todo Add routine for recognizing leap years 
-!> @todo Add recognition of exact days of week (Monday, Tuesday, etc.)
-!> @todo Reconsider whether to remove day_of_year_init from the namelist: we 
-!>       already implemented changes for calculating it from date_init in 
-!>       calc_date_and_time
-!> @todo time_utc during spin-up  
-!------------------------------------------------------------------------------!
- MODULE date_and_time_mod
-
-    USE control_parameters,                                                   &
-        ONLY:  coupling_start_time, days_since_reference_point,               &
-               message_string, simulated_time, time_since_reference_point
-
-    USE kinds
-
-
-    IMPLICIT NONE
-
-    PRIVATE
-
-!-- Variables Declaration
-
-    INTEGER(iwp)        ::  day_of_year      = 0   !< day of the year (DOY)
-    INTEGER(iwp)        ::  day_of_year_init = 0   !< DOY at model start (default: 0)
-
-    ! --- Most of these indices are updated by the routine calc_date_and_time according to the current date and time of the simulation
-    INTEGER(iwp)        ::  hour_of_year = 1                        !< hour of the current year (1:8760(8784))
-    INTEGER(iwp)        ::  hour_of_day=1                           !< hour of the current day (1:24)
-    INTEGER(iwp)        ::  day_of_month=0                          !< day of the current month (1:31)
-    INTEGER(iwp)        ::  month_of_year=0                         !< month of the current year (1:12)
-    INTEGER(iwp)        ::  current_year=0                          !< current year
-    INTEGER(iwp)        ::  hour_call_emis=0                        !< index used to call the emissions just once every hour
-
-    INTEGER(iwp)        ::  index_mm                                !< index months of the default emission mode
-    INTEGER(iwp)        ::  index_dd                                !< index days of the default emission mode
-    INTEGER(iwp)        ::  index_hh                                !< index hours of the emission mode
-
-    REAL(wp)            ::  time_utc                     !< current model time in UTC
-    REAL(wp)            ::  time_utc_emis                !< current emission module time in UTC
-    REAL(wp)            ::  time_utc_init = 43200.0_wp   !< UTC time at model start
-    REAL(wp)            ::  time_update                  !< used to calculate actual second of the simulation
- 
-    REAL(wp), PARAMETER ::  d_hours_day    = 1.0_wp / 24.0_wp       !< inverse of hours per day (1/24)
-    REAL(wp), PARAMETER ::  d_seconds_hour = 1.0_wp / 3600.0_wp     !< inverse of seconds per hour (1/3600)
-    REAL(wp), PARAMETER ::  d_seconds_year = 1.0_wp / 31536000.0_wp !< inverse of the seconds per year (1/(365*86400))
-    
-    CHARACTER(len=8)    ::  date_init = "21062017"                  !< Starting date of simulation: We selected this because it was a monday
- 
-    !> --- Parameters
-    INTEGER, PARAMETER, DIMENSION(12) :: days = (/31,28,31,30,31,30,31,31,30,31,30,31/) ! total number of days for each month (no leap year)
-
-    SAVE
-
-!-- INTERFACES PART
-    !-- Read initial day and time of simulation
-    INTERFACE init_date_and_time
-       MODULE PROCEDURE init_date_and_time
-    END INTERFACE init_date_and_time
-
-    !-- Get hour index in the DEAFULT case of chemistry emissions :
-    INTERFACE time_default_indices
-       MODULE PROCEDURE time_mdh_indices
-       MODULE PROCEDURE time_hour_indices
-    END INTERFACE time_default_indices
-
-    !-- Get hour index in the PRE-PROCESSED case of chemistry emissions :
-    INTERFACE time_preprocessed_indices
-       MODULE PROCEDURE time_preprocessed_indices
-    END INTERFACE time_preprocessed_indices
-
-
-    !-- Calculate current date and time
-    INTERFACE calc_date_and_time
-       MODULE PROCEDURE calc_date_and_time
-    END INTERFACE
-
-
-    !-- Public Interfaces
-    PUBLIC calc_date_and_time, time_default_indices, init_date_and_time, time_preprocessed_indices
-
-    !-- Public Variables
-    PUBLIC date_init, d_hours_day, d_seconds_hour, d_seconds_year,               &
-           day_of_year, day_of_year_init, time_utc, time_utc_init, day_of_month, &
-           month_of_year, index_mm, index_dd, index_hh, hour_of_day, hour_of_year, &
-           hour_call_emis
-
- CONTAINS
-
-
- !------------------------------------------------------------------------------!
- !> Reads starting date from namelist
- !------------------------------------------------------------------------------!
-  
-    SUBROUTINE init_date_and_time
-
-       IMPLICIT NONE
-
-       !--    Variables Definition
-       INTEGER ::  i_mon       !< Index for going through the different months
-
-       IF  (day_of_year_init == 0) THEN
-          ! Day of the month at starting time
-          READ(UNIT=date_init(1:2),fmt=*)day_of_month
-
-          ! Month of the year at starting time
-          READ(UNIT=date_init(3:4),fmt=*)month_of_year
-
-          ! Year at starting time
-          READ(UNIT=date_init(5:8),fmt=*)current_year
-       
-       ENDIF
-
-
-       !-- Calculate initial hour of the day: the first hour of the day is from 00:00:00 to 00:59:59. 
-
-       hour_of_day = INT( FLOOR( time_utc_init/3600.0_wp ) ) + 1
-
-       !-- Calculate initial day day_of_year_init in case date_init is given or day_of_year_init is given
-       IF ( day_of_year_init == 0 ) THEN
-
-          !> Condition for printing an error when date_init is not provided when day_of_year_init is not given in the namelist or when the format of the date is not the one required by PALM. 
-          IF ( day_of_month > 0 .AND. day_of_month <= 31 .AND. month_of_year > 0 .AND. month_of_year <= 12) THEN
-        
-             IF ( month_of_year == 1 ) THEN  !!month of year is read in input
-
-                day_of_year_init = day_of_month
-
-             ELSE
-
-                day_of_year_init= SUM(days( 1:(month_of_year-1) )) + day_of_month  !day_of_month is read in input in this case
-
-             ENDIF
-!kanani: Revise, we cannot force users to provide date_init, maybe set a default value?
-!           ELSE
-! 
-!              message_string = 'date_init not provided in the namelist or'             //          &
-!                               ' given in the wrong format: MUST BE DDMMYYYY'                        
-!              CALL message( 'calc_date_and_time', 'DT0100', 2, 2, 0, 6, 0 ) 
-     
-          ENDIF
-
-       ENDIF
-
-       
-       !-- Initial day of the year
-       day_of_year = day_of_year_init
-
-       !-- Initial hour of the year
-       hour_of_year = ( (day_of_year-1) * 24 ) + hour_of_day
-
-       !--Initial day of the month and month of the year
-       !> --------------------------------------------------------------------------------
-       !> The first case is when date_init is not provided: we only know day_of_year_init      
-       IF ( month_of_year == 0 .AND. day_of_month == 0) THEN
-
-         
-          IF ( day_of_year <= 31 ) THEN
-
-             month_of_year=1
-             day_of_month=day_of_year
-
-          ELSE
-
-             DO i_mon=2,12   !january is considered in the first case
-                IF ( day_of_year <= SUM(days(1:i_mon)) .AND. day_of_year > SUM(days(1:(i_mon-1))) ) THEN
-           
-                   month_of_year=i_mon
-
-                   day_of_month=INT(MOD(day_of_year, SUM(days(1:(i_mon-1))))) 
-
-                   GOTO 38
-
-                ENDIF
-
-             38 ENDDO
-          ENDIF
-       !> --------------------------------------------------------------------------------
-       !> in the second condition both day of month and month_of_year are either given in input (passed to date_init) or we are in some day successive to the initial one, so that day_of_month has already be computed in previous step
-       !>TBD: something to calculate the current year is missing
-       ELSEIF ( day_of_month > 0 .AND. day_of_month <= 31 .AND. month_of_year > 0 .AND. month_of_year <= 12) THEN
- 
-          !> calculate month_of_year. TBD: test the condition when day_of_year==31
- 
-          IF (day_of_year==1) THEN  !> this allows to turn from december to January when passing from a year to another
- 
-             month_of_year = 1
-        
-          ELSE IF (day_of_year > 1 .AND. day_of_year > SUM(days(1:month_of_year))) THEN
-
-             month_of_year = month_of_year + 1
-
-          ENDIF
-
-          !> calculate day_of_month
-          IF ( month_of_year == 1 ) THEN
-           
-            day_of_month=day_of_year
-
-          ELSE
-
-            day_of_month=INT(MOD(day_of_year, SUM(days(1:(month_of_year-1)))))
-
-          ENDIF
-
-
-       ELSE
-
-          !> Condition when date_init is provided but it is given in the wrong format
-          message_string = 'date_init not provided in the namelist or'            //          &
-                              ' given in the wrong format: MUST BE DDMMYYYY'                  
-          CALL message( 'init_date_and_time', 'DT0102', 2, 2, 0, 6, 0 ) 
-
-       ENDIF
-
-
-    END SUBROUTINE init_date_and_time
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Calculate current date and time of the simulation 
-!------------------------------------------------------------------------------!
- 
-    SUBROUTINE calc_date_and_time
-
-       IMPLICIT NONE
-
-!--    Variables Definition
-       INTEGER :: i_mon       !< Index for going through the different months
-
-       !> Update simulation time in seconds
-       time_update = simulated_time-coupling_start_time
-
-!--    Calculate current day of the simulated time
-       days_since_reference_point=INT(FLOOR( (time_utc_init + time_update) &
-                               / 86400.0_wp ) )
-
-!--    Calculate actual UTC time                        
-       time_utc = MOD((time_utc_init + time_since_reference_point), 86400.0_wp)
-       
-!sB    PRILIMINARY workaround for time_utc changes due to changes in time_since_reference_point in
-!sB    radiation_model_mod during runtime:
-       time_utc_emis = MOD((time_utc_init + time_update), 86400.0_wp)     
-
-!--    Calculate initial day of the year: it is calculated only once. In fact, day_of_year_init is initialized to 0 and then a positive value is passed. This condition is also called only when day_of_year_init is not given in the namelist. 
-
-       IF ( day_of_year_init == 0 ) THEN
-
-          !> Condition for printing an error when date_init is not provided when day_of_year_init is not given in the namelist or when the format of the date is not the one required by PALM. 
-          IF ( day_of_month > 0 .AND. day_of_month <= 31 .AND. month_of_year > 0 .AND. month_of_year <= 12) THEN
-        
-             IF ( month_of_year == 1 ) THEN  !!month of year is read in input
-
-                day_of_year_init = day_of_month
-
-             ELSE
-
-                day_of_year_init= SUM(days( 1:(month_of_year-1) )) + day_of_month  !day_of_month is read in input in this case
-
-             ENDIF
-!kanani: Revise, we cannot force users to provide date_init, maybe set a default value?
-!           ELSE
-! 
-!              message_string = 'date_init not provided in the namelist or'             //          &
-!                               ' given in the wrong format: MUST BE DDMMYYYY'                        
-!              CALL message( 'calc_date_and_time', 'DT0100', 2, 2, 0, 6, 0 ) 
-     
-          ENDIF
-
-       ENDIF
-
-      !-- Calculate actual hour of the day: the first hour of the day is from 00:00:00 to 00:59:59. 
-
-      hour_of_day = INT( FLOOR( time_utc_emis/3600.0_wp ) ) + 1
-
-!--    Calculate current day of the year !TBD: considetr leap years
-       IF ( (day_of_year_init + days_since_reference_point)  > 365 ) THEN
-
-          day_of_year=INT(MOD((day_of_year_init + days_since_reference_point), 365.0_wp))
-
-       ELSE
-          
-          day_of_year = day_of_year_init + days_since_reference_point
-
-       ENDIF
-
-!
-!--    Calculate current hour of the year
-       hour_of_year = ( (day_of_year-1) * 24 ) + hour_of_day  !> actual hour of the year
-        
-
-!
-!--    UPDATE actual day of the month and month of the year
-       !> --------------------------------------------------------------------------------
-       !> The first case is when date_init is not provided: we only know day_of_year_init      
-       IF ( month_of_year == 0 .AND. day_of_month == 0) THEN
-
-          !> The first case is when date_init is not provided: we only know day_of_year_init
-          !DO i_mon=1,12
-             !IF (day_of_year <= SUM(days(1:i_mon))) THEN
-          IF ( day_of_year <= 31 ) THEN
-
-             month_of_year=1
-             day_of_month=day_of_year
-
-          ELSE
-
-             DO i_mon=2,12   !january is considered in the first case
-                IF ( day_of_year <= SUM(days(1:i_mon)) .AND. day_of_year > SUM(days(1:(i_mon-1))) ) THEN
-           
-                   month_of_year=i_mon
-
-                   day_of_month=INT(MOD(day_of_year, SUM(days(1:(i_mon-1))))) 
-
-                   GOTO 38
-
-                ENDIF
-
-             38 ENDDO
-          ENDIF
-       !> --------------------------------------------------------------------------------
-       !> in the second condition both day of month and month_of_year are either given in input (passed to date_init) or we are in some day successive to the initial one, so that day_of_month has already be computed in previous step
-       !>TBD: something to calculate the current year is missing
-       ELSEIF ( day_of_month > 0 .AND. day_of_month <= 31 .AND. month_of_year > 0 .AND. month_of_year <= 12) THEN
- 
-          !> calculate month_of_year. TBD: test the condition when day_of_year==31
- 
-          IF (day_of_year==1) THEN  !> this allows to turn from december to January when passing from a year to another
- 
-             month_of_year = 1
-        
-          ELSE IF (day_of_year > 1 .AND. day_of_year > SUM(days(1:month_of_year))) THEN
-
-             month_of_year = month_of_year + 1
-
-          ENDIF
-
-          !> calculate day_of_month
-          IF ( month_of_year == 1 ) THEN
-           
-            day_of_month=day_of_year
-
-          ELSE
-
-            day_of_month=INT(MOD(day_of_year, SUM(days(1:(month_of_year-1)))))
-
-          ENDIF
-
-          ! fix the date if the day is 1st and earlier day is needed due to spinup
-          IF ( day_of_month < 1 ) THEN
- 
-             ! if the day is the first day in the year
-             IF ( month_of_year  ==  1 ) THEN
-                month_of_year = 12
-                day_of_month = 31
- 
-             ! other cases
-             ELSE
-                month_of_year = month_of_year - 1
-                day_of_month = days(month_of_year)
-             ENDIF
- 
-          ENDIF
-
-      ELSE
-
-          !> Condition when date_init is provided but it is given in the wrong format
-          message_string = 'date_init not provided in the namelist or'            //          &
-                              ' given in the wrong format: MUST BE DDMMYYYY'                  
-          CALL message( 'calc_date_and_time', 'DT0101', 2, 2, 0, 6, 0 ) 
-
-      ENDIF       
-
-    END SUBROUTINE calc_date_and_time
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> This routine determines the time factor index in the PRE-PROCESSED emissions mode.
-!------------------------------------------------------------------------------!
-
- SUBROUTINE time_preprocessed_indices(index_hh)
-
-    USE indices
-
-    IMPLICIT NONE
-
-!
-!-- In/output
-    INTEGER, INTENT(INOUT) ::  index_hh    !> Index Hour
-!
-!-- Additional Variables for calculateing indices
-!-- Constants
-    INTEGER, PARAMETER ::  nhour = 24
-
-    IF (days_since_reference_point == 0) THEN
-
-       index_hh=hour_of_day
-
-    ELSE
-
-       index_hh=(days_since_reference_point*nhour)+(hour_of_day)
-
-    ENDIF
-
-
- END SUBROUTINE time_preprocessed_indices
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> This routine determines the time factor index in the mdh case of the DEFAULT chemistry emissions mode.
-!------------------------------------------------------------------------------!
-
- SUBROUTINE time_mdh_indices(daytype_mdh,mo, dd, hh, index_mm, index_dd, index_hh)
-
-    USE indices
-
-    IMPLICIT NONE
-
-    !> IN/OUTPUT
-    INTEGER, INTENT(INOUT) :: mo          !> Month of year
-    INTEGER, INTENT(INOUT) :: dd          !> Day of month
-    INTEGER, INTENT(INOUT) :: hh          !> Hour of day
-    INTEGER, INTENT(INOUT) :: index_mm    !> Index Month
-    INTEGER, INTENT(INOUT) :: index_dd    !> Index Day
-    INTEGER, INTENT(INOUT) :: index_hh    !> Index Hour
-
-    CHARACTER(len=80), INTENT(INOUT) :: daytype_mdh !> type of the day in mdh mode: one of 1-WORKDAY
-                                                    !                                      2-WEEKEND
-                                                    !                                      3-HOLIDAY
-
-    REAL(wp)                         :: frac_day=0  
-
-    !> ------------------------------------------------------------------------
-
-    INTEGER                          :: weekday
-
-    !> CONSTANTS
-    INTEGER, PARAMETER               :: nmonth = 12
-    INTEGER, PARAMETER               :: nday = 7
-    INTEGER, PARAMETER               :: nhour = 24
-
-    frac_day= (dd-1)/nday    !> indicates the week of the month, supposing the month starts on monday
-
-   ! 1:7      1:31  7                   (0:30)/7
-    weekday = dd-( nday * (INT( CEILING( frac_day ) ) ) ) ! for now we let the year start on Monday. 
-
-    !TBD: set weekday correct based on date
-    index_mm = mo
-    index_dd = nmonth + weekday  !> Index of the days in the mdh mode (13:20)
-
-    SELECT CASE(TRIM(daytype_mdh))
-
-       CASE ("workday")
-       
-          index_hh = nmonth+ nday + hh 
-
-       CASE ("weekend")
-       
-          index_hh = nmonth+ nday + nhour + hh 
-
-       CASE ("holiday")
-       
-          index_hh = nmonth+ nday + 2*nhour + hh 
-
-    END SELECT
-
-
- END SUBROUTINE time_mdh_indices
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> This routine determines the time factor index in the HOURLY case of the DEFAULT emissions mode.
-!------------------------------------------------------------------------------!
-
- SUBROUTINE time_hour_indices(mo,dd,hh,index_hh)
-
-    USE indices
-
-    IMPLICIT NONE
-
-    !> IN/OUTPUT
-    INTEGER, INTENT(INOUT)              :: mo          !> Month
-    INTEGER, INTENT(INOUT)              :: hh          !> Hour
-    INTEGER, INTENT(INOUT)              :: dd          !> Day
-    INTEGER, INTENT(INOUT)              :: index_hh    !> Index Hour
- 
-    !> Additional Variables for calculateing indices
-    INTEGER                             :: index_mm    !> Index Month
-    INTEGER                             :: index_dd    !> Index Day
-    INTEGER                             :: i_mon       !> Index for going through the different months
-    INTEGER                             :: sum_dd      !> Sum days
-
-    !> CONSTANTS
-    INTEGER, PARAMETER                  :: nhour = 24
-    INTEGER, PARAMETER, DIMENSION(12)   :: days = (/31,28,31,30,31,30,31,31,30,31,30,31/) ! no leap year
-    
-
-    index_mm = mo-1
-    index_dd = dd-1
-    sum_dd=0
-
-    IF (mo == 1) THEN
-
-       index_hh=(index_dd*nhour)+hh
-
-    ELSE 
-
-       DO i_mon=1,index_mm
-
-         sum_dd=sum_dd+days(i_mon)
-
-       ENDDO
-      
-       index_hh=(sum_dd*nhour)+(index_dd*nhour)+(hh)
-
-    ENDIF
- 
-
- END SUBROUTINE time_hour_indices
-
-
-END MODULE date_and_time_mod
Index: /palm/trunk/SOURCE/header.f90
===================================================================
--- /palm/trunk/SOURCE/header.f90	(revision 4226)
+++ /palm/trunk/SOURCE/header.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4223 2019-09-10 09:20:47Z gronemeier
 ! Write information about rotation angle
 ! 
@@ -75,7 +78,4 @@
         ONLY:  log_point_s
 
-    USE date_and_time_mod,                                                     &
-        ONLY:  day_of_year_init, time_utc_init
-
     USE grid_variables,                                                        &
         ONLY:  dx, dy
@@ -100,4 +100,7 @@
                sa_vertical_gradient, sa_vertical_gradient_level,               &
                sa_vertical_gradient_level_ind
+
+    USE palm_date_time_mod,                                                    &
+        ONLY:  get_date_time
 
     USE pegrid
@@ -137,4 +140,5 @@
     CHARACTER (LEN=70) ::  char1               !< dummy varialbe used for various strings
     CHARACTER (LEN=70) ::  char2               !< string containing informating about the advected distance in case of Galilei transformation
+    CHARACTER (LEN=23) ::  date_time_str       !< string for date and time information
     CHARACTER (LEN=70) ::  dopr_chr            !< string indicating profile output variables
     CHARACTER (LEN=70) ::  do2d_xy             !< string indicating 2D-xy output variables
@@ -1472,7 +1476,8 @@
 
 !
-!-- Day of year, UTC
-    WRITE ( io, 456 )  day_of_year_init, time_utc_init
-    
+!-- Day and time during model start
+    CALL get_date_time( 0.0_wp, date_time_str=date_time_str )
+    WRITE ( io, 456 )  TRIM( date_time_str )
+
 !
 !-- Other quantities
@@ -1858,6 +1863,5 @@
 454 FORMAT ('    TKE is not allowed to fall below ',E9.2,' (m/s)**2')
 455 FORMAT ('    initial TKE is prescribed as ',E9.2,' (m/s)**2')
-456 FORMAT (/'    Day of the year at model start :   day_init      =     ',I3 &
-            /'    UTC time at model start        :   time_utc_init = ',F7.1,' s')
+456 FORMAT (/'    Date and time at model start : ',A)
 457 FORMAT ('    RANS-mode constants: c_0 = ',F9.5/         &
             '                         c_1 = ',F9.5/         &
Index: /palm/trunk/SOURCE/indoor_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4227)
@@ -21,9 +21,12 @@
 ! Current revisions:
 ! -----------------
-!
-!
+! 
+! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+!
+! 4217 2019-09-04 09:47:05Z scharf
 ! Corrected "Former revisions" section
 !
@@ -1053,12 +1056,12 @@
 !         ONLY:  c_p
 
-!     USE control_parameters,                                                    &
-!         ONLY:  rho_surface
-
-    USE date_and_time_mod,                                                     &
-        ONLY:  time_utc
+    USE control_parameters,                                                    &
+        ONLY:  time_since_reference_point
 
     USE grid_variables,                                                        &
         ONLY:  dx, dy
+
+    USE palm_date_time_mod,                                                    &
+        ONLY:  get_date_time, seconds_per_hour
 
     USE pegrid
@@ -1085,4 +1088,5 @@
     REAL(wp) ::  indoor_wall_window_temperature   !< weighted temperature of innermost wall/window layer
     REAL(wp) ::  near_facade_temperature          !< outside air temperature 10cm away from facade
+    REAL(wp) ::  second_of_day                    !< second of the current day
     REAL(wp) ::  time_utc_hour                    !< time of day (hour UTC)
 
@@ -1091,5 +1095,6 @@
 !
 !-- Determine time of day in hours. 
-    time_utc_hour = time_utc / 3600.0_wp
+    CALL get_date_time( time_since_reference_point, second_of_day=second_of_day )
+    time_utc_hour = second_of_day / seconds_per_hour
 !
 !-- Following calculations must be done for each facade element.
Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 4226)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4223 2019-09-10 09:20:47Z gronemeier
 ! Deallocate temporary string array since it may be re-used to read different 
 ! input data in other modules
@@ -177,4 +180,7 @@
         ONLY:  nesting_offl_init
 
+    USE palm_date_time_mod,                                                    &
+        ONLY:  set_reference_date_time
+
     USE pegrid
 
@@ -266,4 +272,7 @@
     
     CALL location_message( 'model initialization', 'start' )
+!
+!-- Set reference date-time
+    CALL set_reference_date_time( date_time_str=origin_date_time )
 
     IF ( debug_output )  CALL debug_message( 'allocating arrays', 'start' )
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 4226)
+++ /palm/trunk/SOURCE/modules.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Add origin_date_time
+! 
+! 4146 2019-08-07 07:47:36Z gronemeier
 ! Added rotation_angle
 ! 
@@ -471,4 +474,5 @@
     CHARACTER (LEN=8)    ::  coupling_char = ''                           !< appended to filenames in coupled or nested runs ('_O': ocean PE,
                                                                           !< '_NV': vertically nested atmosphere PE, '_N##': PE of nested domain ##
+    CHARACTER (LEN=23)   ::  origin_date_time = '2019-06-21 12:00:00 +00' !< date and time to be simulated
     CHARACTER (LEN=10)   ::  run_date = ' '                               !< date of simulation run
     CHARACTER (LEN=8)    ::  run_time = ' '                               !< time of simulation run
Index: /palm/trunk/SOURCE/nesting_offl_mod.f90
===================================================================
--- /palm/trunk/SOURCE/nesting_offl_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/nesting_offl_mod.f90	(revision 4227)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! implement new palm_date_time_mod
 ! 
 ! Former revisions:
@@ -164,7 +164,4 @@
                log_point_s
 
-    USE date_and_time_mod,                                                     &
-        ONLY:  time_utc_init
-
     USE grid_variables
 
@@ -191,4 +188,7 @@
                pids_id
 
+    USE palm_date_time_mod,                                                    &
+        ONLY:  get_date_time
+
     USE pegrid
 
@@ -274,4 +274,5 @@
 
     REAL(wp) ::  fac_dt              !< interpolation factor
+    REAL(wp) ::  time_utc_init       !< time in seconds-of-day of origin_date_time
     REAL(wp) ::  zi_ribulk = 0.0_wp  !< boundary-layer depth according to bulk Richardson criterion, i.e. the height where Ri_bulk exceeds the critical
                                      !< bulk Richardson number of 0.2
@@ -1800,4 +1801,7 @@
        INTEGER(iwp) ::  n !< running index for chemical species
 
+!
+!--    Get time_utc_init from origin_date_time
+       CALL get_date_time( 0.0_wp, second_of_day = time_utc_init )
 
 !--    Allocate arrays for geostrophic wind components. Arrays will 
Index: /palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Replace function date_time_string by call to get_date_time
+! 
+! 4223 2019-09-10 09:20:47Z gronemeier
 ! replaced rotation angle from input-netCDF file
 ! by namelist parameter 'rotation_angle'
@@ -6869,13 +6872,13 @@
         ONLY:  revision, run_date, run_time, run_zone, runnr, version
 
-    USE date_and_time_mod,                                                     &
-       ONLY:   day_of_year_init, time_utc_init
-
     USE netcdf_data_input_mod,                                                 &
         ONLY:  input_file_atts
 
+    USE palm_date_time_mod,                                                    &
+        ONLY:  date_time_str_len, get_date_time
+
     IMPLICIT NONE
 
-    CHARACTER(LEN=23) ::  origin_time_string  !< string containing date and time of origin
+    CHARACTER(LEN=date_time_str_len) ::  origin_time_string  !< string containing date-time of origin
 
     CHARACTER(LEN=*), INTENT(IN)  ::  data_content  !< describes the type of data in file
@@ -6885,6 +6888,6 @@
     INTEGER, INTENT(IN)  ::  ncid      !< file id
 !
-!-- Compose date-time string for origin_time
-    origin_time_string = date_time_string( day_of_year_init, time_utc_init )
+!-- Get date-time string for origin_time
+    CALL get_date_time( 0.0_wp, date_time_str=origin_time_string )
 
 #if defined( __netcdf )
@@ -7242,92 +7245,3 @@
  END SUBROUTINE convert_utm_to_geographic
 
- !------------------------------------------------------------------------------!
- ! Description:
- ! ------------
- !> Compose string containing date and time of format 'YYYY-MM-DD hh:mm:ss ZZZ'
- !> from day_of_year and second_of_day.
- !------------------------------------------------------------------------------!
- FUNCTION date_time_string( day_of_year, second_of_day )
-
-    IMPLICIT NONE
-
-    CHARACTER(LEN=1) ::  plus_minus  !< either '+' or '-'
-
-    CHARACTER(LEN=23) ::  date_time_string  !< string containing date and time
-
-    INTEGER(iwp) ::  day          !< day of month
-    INTEGER(iwp) ::  err          !< error code
-    INTEGER(iwp) ::  i            !< loop index
-    INTEGER(iwp) ::  hour         !< hour of the day
-    INTEGER(iwp) ::  minute       !< minute of the hour
-    INTEGER(iwp) ::  month        !< month of year
-    INTEGER(iwp) ::  year = 2019  !< year (no leap year)
-    INTEGER(iwp) ::  zone = 0     !< time zone
-
-    INTEGER(iwp), INTENT(IN) ::  day_of_year  !< day of year to start with
-
-    INTEGER, DIMENSION(12) :: days_per_month = &  !< total number of days for
-    (/31,28,31,30,31,30,31,31,30,31,30,31/)       !< each month (no leap year)
-
-    REAL(wp) ::  second  !< second of the minute
-
-    REAL(wp), INTENT(IN) ::  second_of_day  !< second of the day
-
-
-    err = 0_iwp
-!
-!-- Check day_of_year
-    IF ( day_of_year < 1_iwp .OR. day_of_year > SUM(days_per_month) )  THEN
-       err = err + 1_iwp
-    ENDIF
-!
-!-- Check second_of_day
-    IF ( second_of_day < 0.0_wp  .OR.  second_of_day > 86400.0_wp )  THEN
-       err = err + 2_iwp
-    ENDIF
-!
-!-- Execute only if given values are valid
-    IF ( err == 0_iwp )  THEN
-
-       day = day_of_year
-       month = 0_iwp
-
-       DO  i = 1, 12
-          day = day - days_per_month(i)
-          IF ( day < 0 )  THEN
-             day = day + days_per_month(i)
-             month = i
-             EXIT
-          ENDIF
-       ENDDO
-
-       hour = INT( second_of_day / 3600.0_wp, KIND=iwp )
-
-       second = second_of_day - 3600.0_wp * REAL( hour, KIND=wp )
-
-       minute =  INT( second / 60.0_wp, KIND=iwp )
-
-       second = second - 60.0_wp * REAL( minute, KIND=wp )
-
-       IF ( zone < 0_iwp )  THEN
-          plus_minus = '-'
-       ELSE
-          plus_minus = '+'
-       ENDIF
-
-       WRITE( date_time_string, 100 )                               &
-          year, month, day, hour, minute, INT( second, KIND=iwp ),  &
-          plus_minus, zone
-
-    ELSE
-!
-!--   Return empty string if input is invalid
-      date_time_string = REPEAT( " ", LEN(date_time_string) )
-
-    ENDIF
-
- 100 FORMAT (I4,'-',I2.2,'-',I2.2,1X,I2.2,':',I2.2,':',I2.2,1X,A1,I2.2)
-
- END FUNCTION date_time_string
-
  END MODULE netcdf_interface
Index: /palm/trunk/SOURCE/palm.f90
===================================================================
--- /palm/trunk/SOURCE/palm.f90	(revision 4226)
+++ /palm/trunk/SOURCE/palm.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4094 2019-07-12 09:24:21Z gronemeier
 ! Corrected "Former revisions" section
 ! 
@@ -77,7 +80,4 @@
     USE cpulog,                                                                &
         ONLY:  cpu_log, log_point, log_point_s, cpu_statistics
-
-    USE date_and_time_mod,                                                     &
-        ONLY:  calc_date_and_time, init_date_and_time
 
     USE diagnostic_output_quantities_mod,                                      &
@@ -267,7 +267,4 @@
 !-- Check control parameters and deduce further quantities
     CALL check_parameters
-!
-!-- Initial time for chem_emissions_mod
-    CALL init_date_and_time
 
     CALL init_3d_model
Index: /palm/trunk/SOURCE/palm_date_time_mod.f90
===================================================================
--- /palm/trunk/SOURCE/palm_date_time_mod.f90	(revision 4227)
+++ /palm/trunk/SOURCE/palm_date_time_mod.f90	(revision 4227)
@@ -0,0 +1,617 @@
+!> @file palm_date_time_mod.f90
+!------------------------------------------------------------------------------!
+! This file is part of the PALM model system.
+!
+! PALM is free software: you can redistribute it and/or modify it under the
+! terms of the GNU General Public License as published by the Free Software
+! Foundation, either version 3 of the License, or (at your option) any later
+! version.
+!
+! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
+! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along with
+! PALM. If not, see <http://www.gnu.org/licenses/>.
+!
+! Copyright 1997-2019 Leibniz Universitaet Hannover
+!------------------------------------------------------------------------------!
+!
+! Current revisions:
+! ------------------
+! 
+! 
+! Former revisions:
+! -----------------
+! $Id$
+! Complete rework of module date_and_time_mod:
+!  - renamed module to prevent confusion with
+!    FORTRAN Standard routine date_and_time
+!  - introduce date_time_type
+!  - add set_reference_date_time
+!  - add get_date_time
+!  - capsule whole calculation of date and time variables within this routine
+!  - removed all variables/routines not belonging to this module
+!
+!
+! Authors:
+! --------
+!> @author Tobias Gronemeier (LUH)
+!
+! Description:
+! ------------
+!> This routine calculates all needed information on date and time used by
+!> other modules
+!>
+!> @todo Consider leap seconds
+!> @note Time_zone only supports full-hour time zones, i.e., time zones like
+!>       Australian Central Standard Time (UTC+9.5) are not possible
+!------------------------------------------------------------------------------!
+ MODULE palm_date_time_mod
+
+    USE control_parameters,                                                    &
+         ONLY:  message_string
+
+    USE kinds
+
+    IMPLICIT NONE
+
+!
+!-- Parameter Definition
+    INTEGER(iwp), PARAMETER ::  date_time_str_len  = 23_iwp                                 !< length of date_time strings
+    INTEGER(iwp), PARAMETER ::  days_per_week      = 7_iwp                                  !< days in a week
+    INTEGER(iwp), PARAMETER ::  hours_per_day      = 24_iwp                                 !< hours in a day
+    INTEGER(iwp), PARAMETER ::  minutes_per_hour   = 60_iwp                                 !< minutes in an hour
+    INTEGER(iwp), PARAMETER ::  months_per_year    = 12_iwp                                 !< months in a year
+
+    REAL(wp),     PARAMETER ::  seconds_per_minute = 60.0_wp                                !< seconds in a minute
+    REAL(wp),     PARAMETER ::  seconds_per_hour   = seconds_per_minute * minutes_per_hour  !< seconds in an hour
+    REAL(wp),     PARAMETER ::  seconds_per_day    = seconds_per_hour * hours_per_day       !< seconds in a day
+
+    CHARACTER(LEN=3), DIMENSION(days_per_week), PARAMETER ::  &
+       weekdays = (/"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"/)                       !< names of weekdays
+
+    INTEGER, DIMENSION(months_per_year), PARAMETER ::  &
+       days_per_month_noleapyear = (/31,28,31,30,31,30,31,31,30,31,30,31/)                  !< days for each month (no leap year)
+
+    INTEGER, DIMENSION(months_per_year), PARAMETER ::  &
+       days_per_month_leapyear = (/31,29,31,30,31,30,31,31,30,31,30,31/)                    !< days for each month (leap year)
+
+    INTEGER, DIMENSION(121), PARAMETER ::  leap_years = &                                   !< list of leap years
+        (/1804_iwp, 1808_iwp, 1812_iwp, 1816_iwp, 1820_iwp, 1824_iwp, 1828_iwp, 1832_iwp, &
+          1836_iwp, 1840_iwp, 1844_iwp, 1848_iwp, 1852_iwp, 1856_iwp, 1860_iwp, 1864_iwp, &
+          1868_iwp, 1872_iwp, 1876_iwp, 1880_iwp, 1884_iwp, 1888_iwp, 1892_iwp, 1896_iwp, &
+          1904_iwp, 1908_iwp, 1912_iwp, 1916_iwp, 1920_iwp, 1924_iwp, 1928_iwp, 1932_iwp, &
+          1936_iwp, 1940_iwp, 1944_iwp, 1948_iwp, 1952_iwp, 1956_iwp, 1960_iwp, 1964_iwp, &
+          1968_iwp, 1972_iwp, 1976_iwp, 1980_iwp, 1984_iwp, 1988_iwp, 1992_iwp, 1996_iwp, &
+          2000_iwp, 2004_iwp, 2008_iwp, 2012_iwp, 2016_iwp, 2020_iwp, 2024_iwp, 2028_iwp, &
+          2032_iwp, 2036_iwp, 2040_iwp, 2044_iwp, 2048_iwp, 2052_iwp, 2056_iwp, 2060_iwp, &
+          2064_iwp, 2068_iwp, 2072_iwp, 2076_iwp, 2080_iwp, 2084_iwp, 2088_iwp, 2092_iwp, &
+          2096_iwp, 2104_iwp, 2108_iwp, 2112_iwp, 2116_iwp, 2120_iwp, 2124_iwp, 2128_iwp, &
+          2132_iwp, 2136_iwp, 2140_iwp, 2144_iwp, 2148_iwp, 2152_iwp, 2156_iwp, 2160_iwp, &
+          2164_iwp, 2168_iwp, 2172_iwp, 2176_iwp, 2180_iwp, 2184_iwp, 2188_iwp, 2192_iwp, &
+          2196_iwp, 2204_iwp, 2208_iwp, 2212_iwp, 2216_iwp, 2220_iwp, 2224_iwp, 2228_iwp, &
+          2232_iwp, 2236_iwp, 2240_iwp, 2244_iwp, 2248_iwp, 2252_iwp, 2256_iwp, 2260_iwp, &
+          2264_iwp, 2268_iwp, 2272_iwp, 2276_iwp, 2280_iwp, 2284_iwp, 2288_iwp, 2292_iwp, &
+          2296_iwp /)
+
+!
+!-- Type Definition
+    TYPE date_time_type
+       INTEGER(iwp)                        ::  year           = -HUGE(0_iwp)               !< year
+       INTEGER(iwp)                        ::  month          = -HUGE(0_iwp)               !< month of year
+       INTEGER(iwp)                        ::  day            = -HUGE(0_iwp)               !< day of month
+       INTEGER(iwp)                        ::  hour           = -HUGE(0_iwp)               !< hour of day
+       INTEGER(iwp)                        ::  minute         = -HUGE(0_iwp)               !< minute of hour
+       INTEGER(iwp)                        ::  zone           = -HUGE(0_iwp)               !< time zone
+
+       REAL(wp)                            ::  second         = -HUGE(0.0_wp)              !< second of minute
+       REAL(wp)                            ::  second_of_year = -HUGE(0.0_wp)              !< second of year
+
+       INTEGER(iwp)                        ::  days_per_year  = -HUGE(0_iwp)               !< days within a year
+
+       INTEGER, DIMENSION(months_per_year) ::  days_per_month = days_per_month_noleapyear  !< list of total days per month
+    END TYPE date_time_type
+
+!
+!-- Variable Declaration
+    LOGICAL              ::  reference_date_time_is_set = .FALSE.  !< true if reference_date_time is set
+
+    TYPE(date_time_type) ::  reference_date_time                   !< reference date-time
+
+    SAVE
+
+    PRIVATE
+!
+!-- Set reference date and time
+    INTERFACE set_reference_date_time
+        MODULE PROCEDURE set_reference_date_time
+    END INTERFACE set_reference_date_time
+!
+!-- Return date and time information
+    INTERFACE get_date_time
+       MODULE PROCEDURE get_date_time
+    END INTERFACE get_date_time
+!
+!-- Public Interfaces
+    PUBLIC &
+       get_date_time, &
+       set_reference_date_time
+!
+!-- Public variables
+    PUBLIC                 &
+       date_time_str_len,  &
+       days_per_week,      &
+       hours_per_day,      &
+       minutes_per_hour,   &
+       months_per_year,    &
+       seconds_per_minute, &
+       seconds_per_hour,   &
+       seconds_per_day,    &
+       weekdays
+
+ CONTAINS
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Set reference date-time.
+!> Only a single call is allowed to this routine during execution.
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE set_reference_date_time( date_time_str )
+
+    CHARACTER(LEN=date_time_str_len), INTENT(IN) ::  date_time_str  !< string containing date-time information
+
+!
+!-- Check if date and time are already set
+    IF ( reference_date_time_is_set )  THEN
+       !> @note This error should never be observed by a user.
+       !>       It can only appear if the code was modified.
+       WRITE( message_string, * ) 'Multiple calls to set_reference_date_time detected.&' //  &
+                                  'The reference date-time must be set only once.'
+       CALL message( 'set_reference_date_time', 'PA0680', 2, 2, 0, 6, 0 )
+       RETURN
+
+    ELSE
+
+       reference_date_time = convert_string_to_date_time( date_time_str )
+
+       reference_date_time_is_set = .TRUE.
+
+    ENDIF
+
+ END SUBROUTINE set_reference_date_time
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Return requested date-time information of the reference time + time_since_reference.
+!> An alternative reference date-time string can be specified via 'reference_date_time_str'.
+!> Call to this routine is only possible if a reference time is either specified in the call itself
+!> via 'reference_date_time_str' or previously set by calling routine 'set_reference_date_time'.
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE get_date_time( time_since_reference, reference_date_time_str,    &
+                           year, month, day, hour, minute, second, zone,     &
+                           second_of_day, second_of_year,                    &
+                           day_of_year, day_of_week, weekday, date_time_str, &
+                           days_per_month, days_per_year                     )
+
+    CHARACTER(LEN=date_time_str_len), INTENT(OUT), OPTIONAL ::  date_time_str            !< date-time as string
+    CHARACTER(LEN=1)                                        ::  plus_minus               !< either '+' or '-'
+    CHARACTER(LEN=date_time_str_len), INTENT(IN),  OPTIONAL ::  reference_date_time_str  !< alternative reference date-time
+    CHARACTER(LEN=3),                 INTENT(OUT), OPTIONAL ::  weekday                  !< weekday
+
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  day              !< day of month
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  day_of_week      !< number of weekday
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  day_of_year      !< day of the year
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  hour             !< hour of day
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  minute           !< minute of hour
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  month            !< month of year
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  year             !< year
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  zone             !< time zone
+    INTEGER(iwp),                             INTENT(OUT), OPTIONAL ::  days_per_year    !< days per year
+    INTEGER(iwp), DIMENSION(months_per_year), INTENT(OUT), OPTIONAL ::  days_per_month   !< days per year
+
+    REAL(wp), INTENT(OUT), OPTIONAL ::  second                        !< second of minute
+    REAL(wp), INTENT(OUT), OPTIONAL ::  second_of_day                 !< second of day
+    REAL(wp), INTENT(OUT), OPTIONAL ::  second_of_year                !< second of year
+    REAL(wp), INTENT(IN)            ::  time_since_reference          !< seconds between reference time and current time
+
+    TYPE(date_time_type)            ::  date_time                     !< date-time which to return
+    TYPE(date_time_type)            ::  internal_reference_date_time  !< internal reference date-time
+
+!
+!-- Check if a reference date-time is given
+    IF ( .NOT. reference_date_time_is_set  .AND.  .NOT. PRESENT( reference_date_time_str ) )  THEN
+       !> @note This error should never be observed by a user.
+       !>       It can only appear if the code was modified.
+       WRITE( message_string, * ) 'No reference date-time defined. '//                   &
+                                  'Returning date-time information is not possible. ' // &
+                                  'Either specify reference_date_time_str ' //           &
+                                  'or set a reference via set_reference_date_time.'
+       CALL message( 'get_date_time', 'PA0677', 2, 2, 0, 6, 0 )
+       RETURN
+    ENDIF
+!
+!-- Set internal reference date-time
+    IF ( PRESENT( reference_date_time_str ) )  THEN
+       internal_reference_date_time = convert_string_to_date_time( reference_date_time_str )
+    ELSE
+       internal_reference_date_time = reference_date_time
+    ENDIF
+!
+!-- Add time to reference time
+    date_time = add_date_time( time_since_reference, internal_reference_date_time )
+!
+!-- Set requested return values
+    IF ( PRESENT( year           ) )  year           = date_time%year
+    IF ( PRESENT( month          ) )  month          = date_time%month
+    IF ( PRESENT( day            ) )  day            = date_time%day
+    IF ( PRESENT( hour           ) )  hour           = date_time%hour
+    IF ( PRESENT( minute         ) )  minute         = date_time%minute
+    IF ( PRESENT( second         ) )  second         = date_time%second
+    IF ( PRESENT( zone           ) )  zone           = date_time%zone
+    IF ( PRESENT( second_of_year ) )  second_of_year = date_time%second_of_year
+    IF ( PRESENT( second_of_day  ) )  second_of_day  = get_second_of_day( date_time )
+    IF ( PRESENT( day_of_year    ) )  day_of_year    = get_day_of_year( date_time )
+    IF ( PRESENT( day_of_week    ) )  day_of_week    = get_day_of_week( date_time )
+    IF ( PRESENT( weekday        ) )  weekday        = weekdays( get_day_of_week( date_time ) )
+    IF ( PRESENT( days_per_month ) )  days_per_month = date_time%days_per_month
+    IF ( PRESENT( days_per_year  ) )  days_per_year  = date_time%days_per_year
+
+    IF ( PRESENT( date_time_str ) )  THEN
+       IF ( date_time%zone < 0_iwp )  THEN
+          plus_minus = '-'
+       ELSE
+          plus_minus = '+'
+       ENDIF
+       WRITE( UNIT = date_time_str,                                                 &
+              FMT = '(I4,"-",I2.2,"-",I2.2,1X,I2.2,":",I2.2,":",I2.2,1X,A1,I2.2)' ) &
+          date_time%year, date_time%month, date_time%day,                           &
+          date_time%hour, date_time%minute, INT( date_time%second ),                &
+          plus_minus, ABS( date_time%zone )
+    ENDIF
+
+ END SUBROUTINE get_date_time
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Convert a date-time string into a date_time object.
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION convert_string_to_date_time( date_time_str ) RESULT( date_time )
+
+    CHARACTER(LEN=date_time_str_len), INTENT(IN) ::  date_time_str  !< date-time as string
+
+    INTEGER(iwp)                                 ::  read_status    !< returned status of read command
+
+    TYPE(date_time_type)                         ::  date_time      !< requested date-time object
+
+!
+!-- Decompose string to date-time information
+    READ( UNIT = date_time_str( 1: 4), IOSTAT = read_status, FMT = '(I4)'   )  date_time%year
+    IF ( read_status == 0 )  &
+       READ( UNIT = date_time_str( 6: 7), IOSTAT = read_status, FMT = '(I2)'   )  date_time%month
+    IF ( read_status == 0 )  &
+       READ( UNIT = date_time_str( 9:10), IOSTAT = read_status, FMT = '(I2)'   )  date_time%day
+    IF ( read_status == 0 )  &
+       READ( UNIT = date_time_str(12:13), IOSTAT = read_status, FMT = '(I2)'   )  date_time%hour
+    IF ( read_status == 0 )  &
+       READ( UNIT = date_time_str(15:16), IOSTAT = read_status, FMT = '(I2)'   )  date_time%minute
+    IF ( read_status == 0 )  &
+       READ( UNIT = date_time_str(18:19), IOSTAT = read_status, FMT = '(F2.0)' )  date_time%second
+    IF ( read_status == 0 )  &
+       READ( UNIT = date_time_str(21:23), IOSTAT = read_status, FMT = '(I3)'   )  date_time%zone
+
+    IF ( read_status /= 0 )  THEN
+       WRITE( message_string, * ) 'Error while converting date-time string. ' //  &
+                                  'Please check format of date-time string: "' // &
+                                  TRIM( date_time_str ) // '". ' //               &
+                                  'Format must be "YYYY-MM-DD hh:mm:ss ZZZ".'
+       CALL message( 'convert_string_to_date_time', 'PA0678', 2, 2, 0, 6, 0 )
+       RETURN
+    ENDIF
+
+    date_time = update_leapyear_setting( date_time )
+
+    IF ( check_date( date_time, date_time_str ) == 0 )  THEN
+
+       date_time%second_of_year = get_second_of_year( date_time )
+
+!
+!--    Shift time to UTC and set zone to UTC
+       date_time = add_date_time( REAL( -1 * date_time%zone, KIND = wp ) &
+                                  * seconds_per_hour,                    &
+                                  date_time )
+       date_time%zone = 0_iwp
+    ENDIF
+
+ END FUNCTION convert_string_to_date_time
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Add time increment (in seconds) to given date-time and return shifted date-time
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION add_date_time( inc_seconds, date_time_base ) RESULT( date_time )
+
+    INTEGER(iwp)                      ::  i                 !< loop index
+
+    REAL(wp)                          ::  seconds_left      !< seconds which must still be added to new date-time
+    REAL(wp)                          ::  seconds_per_year  !< number of seconds in a year
+
+    REAL(wp),             INTENT(IN)  ::  inc_seconds       !< seconds to be added to date-time
+
+    TYPE(date_time_type)              ::  date_time         !< shifted date-time
+    TYPE(date_time_type), INTENT(IN)  ::  date_time_base    !< date-time to be shifted
+
+!
+!-- Define some parameters
+    date_time = date_time_base
+    seconds_per_year = REAL( date_time%days_per_year,  KIND = wp ) * seconds_per_day
+!
+!-- Shift time
+    date_time%second_of_year = date_time%second_of_year + inc_seconds
+!
+!-- Check if year changes
+!-- First, if year is reduced
+    DO WHILE ( date_time%second_of_year < 0.0_wp )
+       date_time%year = date_time%year - 1_iwp
+       date_time = update_leapyear_setting( date_time )
+       seconds_per_year = REAL( date_time%days_per_year * seconds_per_day, KIND = wp )
+       date_time%second_of_year = date_time%second_of_year + seconds_per_year
+    ENDDO
+!
+!-- Now, if year is increased
+    DO WHILE ( date_time%second_of_year > seconds_per_year )
+       date_time%year = date_time%year + 1_iwp
+       date_time = update_leapyear_setting( date_time )
+       date_time%second_of_year = date_time%second_of_year - seconds_per_year
+       seconds_per_year = REAL( date_time%days_per_year * seconds_per_day, KIND = wp )
+    ENDDO
+!
+!-- Based on updated year and second_of_year, update month, day, hour, minute, second
+    DO  i = 1, months_per_year
+       IF ( date_time%second_of_year < SUM( date_time%days_per_month(1:i) ) * seconds_per_day ) &
+       THEN
+          date_time%month  = i
+          seconds_left     = date_time%second_of_year                                &
+                           - REAL( SUM( date_time%days_per_month(1:i-1) ), KIND=wp ) &
+                           * seconds_per_day
+          date_time%day    = INT( seconds_left / seconds_per_day, KIND = iwp ) + 1_iwp
+          seconds_left     = seconds_left &
+                           - REAL( date_time%day - 1_iwp, KIND = wp ) * seconds_per_day
+          date_time%hour   = INT( seconds_left / seconds_per_hour, KIND = iwp )
+          seconds_left     = seconds_left - REAL( date_time%hour, KIND = wp ) * seconds_per_hour
+          date_time%minute = INT( seconds_left / seconds_per_minute, KIND = iwp )
+          date_time%second = seconds_left - REAL( date_time%minute, KIND = wp ) * seconds_per_minute
+          EXIT
+       ENDIF
+    ENDDO
+
+ END FUNCTION add_date_time
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Return day of year of given date.
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION get_day_of_year( date_time ) RESULT( day_of_year )
+
+    INTEGER(iwp)                     ::  day_of_year         !< day of the year
+
+    TYPE(date_time_type), INTENT(IN) ::  date_time           !< date of which to calculate day of year
+    TYPE(date_time_type)             ::  date_time_internal  !< internal copy of input date-time
+
+
+    date_time_internal = update_leapyear_setting( date_time )
+
+    day_of_year = date_time_internal%day &
+                + SUM( date_time_internal%days_per_month(:date_time_internal%month-1) )
+
+ END FUNCTION get_day_of_year
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Return second of day of given time.
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION get_second_of_day( date_time ) RESULT( second_of_day )
+
+    REAL(wp)                         ::  second_of_day  !< second of the day
+
+    TYPE(date_time_type), INTENT(IN) ::  date_time      !< date of which to calculate second of the day
+
+
+    second_of_day = date_time%second                                                            &
+                  + REAL( ( date_time%hour * minutes_per_hour ) + date_time%minute, KIND = wp ) &
+                  * seconds_per_minute
+
+ END FUNCTION get_second_of_day
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Return second of year of given date-time.
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION get_second_of_year( date_time ) RESULT( second_of_year )
+
+    REAL(wp)                         ::  second_of_year  !< second of the year
+
+    TYPE(date_time_type), INTENT(IN) ::  date_time       !< date of which to calculate second of the year
+
+
+    second_of_year = get_second_of_day( date_time ) &
+                   + REAL( get_day_of_year( date_time ) - 1_iwp, KIND = wp ) * seconds_per_day
+
+ END FUNCTION get_second_of_year
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Return index of the day of the week of the given date-time.
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION get_day_of_week( date_time_in ) RESULT( day_of_week )
+
+    INTEGER(iwp)                     ::  date_time_internal_reference_day_of_week  !< day of week of reference date
+    INTEGER(iwp)                     ::  day_difference                            !< day between given date and reference
+    INTEGER(iwp)                     ::  day_of_week                               !< day of the week
+
+    TYPE(date_time_type), INTENT(IN) ::  date_time_in                              !< date of which to get the weekday
+    TYPE(date_time_type)             ::  date_time_internal                        !< internal date-time
+
+!
+!-- Define reference date from which on the current day of week can be determined
+    date_time_internal%year                  = 2000_iwp
+    date_time_internal%month                 = 1_iwp
+    date_time_internal%day                   = 1_iwp
+    date_time_internal_reference_day_of_week = 6_iwp
+
+!
+!-- First, get the difference if both dates would be in the same year
+    day_difference = get_day_of_year( date_time_in ) - get_day_of_year( date_time_internal )
+!
+!-- Now, shift the year and add the corresponding number of days to the difference
+    IF ( date_time_internal%year < date_time_in%year )  THEN
+
+       DO WHILE ( date_time_internal%year /= date_time_in%year )
+
+          date_time_internal = update_leapyear_setting( date_time_internal )
+          day_difference = day_difference + date_time_internal%days_per_year
+
+          date_time_internal%year = date_time_internal%year + 1_iwp
+
+       ENDDO
+
+    ELSEIF ( date_time_internal%year > date_time_in%year )  THEN
+
+       DO WHILE ( date_time_internal%year /= date_time_in%year )
+
+          date_time_internal%year = date_time_internal%year - 1_iwp
+
+          date_time_internal = update_leapyear_setting( date_time_internal )
+          day_difference = day_difference - date_time_internal%days_per_year
+
+       ENDDO
+
+    ENDIF
+!
+!-- Remove full weeks of day_difference and shift day_of_week of reference by
+!-- remaining days
+    day_of_week = date_time_internal_reference_day_of_week + MOD( day_difference, days_per_week )
+
+    IF ( day_of_week > days_per_week )  THEN
+!
+!--    Shift index again if it is next week (above days_per_week)...
+       day_of_week = day_of_week - days_per_week
+    ELSEIF ( day_of_week <= 0_iwp )  THEN
+!
+!--    ...or if it is last week (below 1)
+       day_of_week = day_of_week + days_per_week
+    ENDIF
+
+ END FUNCTION get_day_of_week
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Check if given year is a leap year and update days per month accordingly.
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION update_leapyear_setting( date_time_in ) RESULT( date_time_out )
+
+    TYPE(date_time_type), INTENT(IN) ::  date_time_in   !< input date-time
+    TYPE(date_time_type)             ::  date_time_out  !< return date-time
+
+
+    date_time_out = date_time_in
+
+    IF ( ANY( date_time_in%year == leap_years ) )  THEN
+       date_time_out%days_per_month = days_per_month_leapyear
+    ELSE
+      date_time_out%days_per_month = days_per_month_noleapyear
+    ENDIF
+
+    date_time_out%days_per_year = SUM( date_time_out%days_per_month )
+
+ END FUNCTION update_leapyear_setting
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Check if given date and time are valid. Returns 0 if all checks are passed.
+!> @todo Revise error message. ATM, gives only last errorneous value even if
+!>       multiple values violate the bounds.
+!--------------------------------------------------------------------------------------------------!
+ FUNCTION check_date( date_time, date_time_str ) RESULT( error_code )
+
+
+    CHARACTER(LEN=6), DIMENSION(7), PARAMETER ::  error_str_list =  &  !< string used for error message
+       (/'year  ', 'month ', 'day   ', 'hour  ', 'minute', 'second', 'zone  '/)
+
+    CHARACTER(LEN=date_time_str_len), INTENT(IN) ::  date_time_str     !< date-time as string
+
+    INTEGER(iwp)                                 ::  error_code        !< error code
+
+    TYPE(date_time_type),             INTENT(IN) ::  date_time         !< date-time to be checked
+
+
+    error_code = 0
+!
+!-- Check date
+    IF ( date_time%month < 1_iwp  .OR.     &
+         date_time%month > months_per_year )  THEN
+       error_code = 2
+    ELSE
+       IF ( date_time%day < 1_iwp  .OR.                               &
+            date_time%day > date_time%days_per_month(date_time%month) )  THEN
+          error_code = 3
+       ENDIF
+    ENDIF
+!
+!-- Check time
+    IF ( date_time%hour < 0_iwp  .OR.   &
+         date_time%hour > hours_per_day )  THEN
+       error_code = 4
+    ELSE
+        IF ( date_time%minute < 0_iwp  .OR.      &
+             date_time%minute > minutes_per_hour )  THEN
+           error_code = 5
+        ELSE
+           IF ( date_time%second < 0.0_wp  .OR.        &
+                date_time%second >= seconds_per_minute )  THEN
+              error_code = 6
+           ENDIF
+        ENDIF
+    ENDIF
+!
+!-- Check time zone
+!-- Bounds defined by maximum and minimum time zone present on earth
+    IF ( date_time%zone < -12_iwp  .OR.  &
+         date_time%zone > 14_iwp )  THEN
+       error_code = 7
+    ENDIF
+!
+!-- Raise error if any check is marked invalid
+    IF ( error_code /= 0 )  THEN
+       WRITE( message_string, * ) 'Date-time values out of bounds: "' //                    &
+                                  TRIM( error_str_list(error_code) ) //                     &
+                                  '" is out of bounds. Please check date-time string: "' // &
+                                  TRIM( date_time_str ) // '". ' //                         &
+                                  'Format must be "YYYY-MM-DD hh:mm:ss ZZZ".'
+       CALL message( 'check_date', 'PA0679', 2, 2, 0, 6, 0 )
+       RETURN
+    ENDIF
+
+ END FUNCTION check_date
+
+ END MODULE palm_date_time_mod
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 4226)
+++ /palm/trunk/SOURCE/parin.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4146 2019-08-07 07:47:36Z gronemeier
 ! added rotation_angle to initialization_parameters
 ! 
@@ -94,7 +97,4 @@
     USE cpulog,                                                                &
         ONLY:  cpu_log_barrierwait
-
-    USE date_and_time_mod,                                                     &
-        ONLY:  date_init, day_of_year_init, time_utc_init
 
     USE grid_variables,                                                        &
@@ -164,6 +164,5 @@
              cycle_mg, damp_level_1d,                                          &
              data_output_during_spinup,                                        &
-             date_init,                                                        &
-             day_of_year_init,                                                 &
+             origin_date_time,                                                 &
              dissipation_1d,                                                   &
              dp_external, dp_level_b, dp_smooth, dpdxy,    &
@@ -203,5 +202,5 @@
              surface_scalarflux, surface_waterflux,                            &
              s_surface, s_surface_initial_change, s_vertical_gradient,         &
-             s_vertical_gradient_level, time_utc_init, timestep_scheme,        &
+             s_vertical_gradient_level, timestep_scheme,                       &
              topography, topography_grid_convention, top_heatflux,             &
              top_momentumflux_u, top_momentumflux_v,                           &
@@ -238,6 +237,5 @@
              cycle_mg, damp_level_1d,                                          &
              data_output_during_spinup,                                        &
-             date_init,                                                        &
-             day_of_year_init,                                                 &
+             origin_date_time,                                                 &
              dissipation_1d,                                                   &
              dp_external, dp_level_b, dp_smooth, dpdxy,                        &
@@ -276,5 +274,5 @@
              surface_scalarflux, surface_waterflux,                            &
              s_surface, s_surface_initial_change, s_vertical_gradient,         &
-             s_vertical_gradient_level, time_utc_init, timestep_scheme,        &
+             s_vertical_gradient_level, timestep_scheme,                       &
              topography, topography_grid_convention, top_heatflux,             &
              top_momentumflux_u, top_momentumflux_v,                           &
Index: /palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4227)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4226 2019-09-10 17:03:24Z suehring
 ! - Netcdf input routine for dimension length renamed
 ! - Define time variable for external radiation input relative to time_utc_init 
@@ -232,9 +235,4 @@
          ONLY:  ddx, ddy, dx, dy 
 
-    USE date_and_time_mod,                                                     &
-        ONLY:  calc_date_and_time, d_hours_day, d_seconds_hour, d_seconds_year,&
-               day_of_year, d_seconds_year, day_of_month, day_of_year_init,    &
-               init_date_and_time, month_of_year, time_utc_init, time_utc
-
     USE indices,                                                               &
         ONLY:  nnx, nny, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,   &
@@ -275,4 +273,8 @@
                real_1d_3d,                                                     &
                vars_pids
+
+    USE palm_date_time_mod,                                                    &
+        ONLY:  date_time_str_len, get_date_time,                               &
+               hours_per_day, seconds_per_hour
 
     USE plant_canopy_model_mod,                                                &
@@ -387,6 +389,10 @@
                 time_radiation = 0.0_wp            !< time since last call of radiation code
 
+    INTEGER(iwp) ::  day_of_year   !< day of the current year
 
     REAL(wp) ::  cos_zenith        !< cosine of solar zenith angle, also z-coordinate of solar unit vector
+    REAL(wp) ::  d_hours_day       !< 1 / hours-per-day
+    REAL(wp) ::  d_seconds_hour    !< 1 / seconds-per-hour
+    REAL(wp) ::  second_of_day     !< second of the current day
     REAL(wp) ::  sun_dir_lat       !< y-coordinate of solar unit vector
     REAL(wp) ::  sun_dir_lon       !< x-coordinate of solar unit vector
@@ -1520,4 +1526,9 @@
           CALL message( 'init_3d_model', 'PA0348', 0, 1, 0, 6, 0 )
        ENDIF
+!
+!--    Precalculate some time constants
+       d_hours_day    = 1.0_wp / REAL( hours_per_day, KIND = wp )
+       d_seconds_hour = 1.0_wp / seconds_per_hour
+
 !
 !--    If required, initialize radiation interactions between surfaces 
@@ -2280,8 +2291,8 @@
 !--       Calculate initial values of current (cosine of) the zenith angle and 
 !--       whether the sun is up
-          CALL calc_zenith
-!
-!--       readjust date and time to its initial value
-          CALL init_date_and_time
+          CALL get_date_time( time_since_reference_point, &
+                              day_of_year=day_of_year,    &
+                              second_of_day=second_of_day )
+          CALL calc_zenith( day_of_year, second_of_day )
 !
 !--       Calculate initial surface albedo for different surfaces
@@ -2640,12 +2651,14 @@
           ENDIF
           
-          IF ( time_rad_f%var1d(0) /= time_utc_init )  THEN
+          CALL get_date_time( 0.0_wp, second_of_day=second_of_day )
+
+          IF ( time_rad_f%var1d(0) /= second_of_day )  THEN
              message_string = 'External radiation forcing: first point in ' // &
-                              'time is /= time_utc_init.'
+                              'time is /= origin_date_time.'
              CALL message( 'radiation_init', 'PA0313', 1, 2, 0, 6, 0 )
           ENDIF
           
           IF ( end_time - spinup_time > time_rad_f%var1d(ntime-1)              &
-                                      - time_utc_init )  THEN
+                                      - second_of_day )  THEN
              message_string = 'External radiation forcing does not cover ' //  &
                               'the entire simulation time.'
@@ -2765,7 +2778,4 @@
 
        END SELECT
-!
-!--    Readjust date and time to its initial value
-       CALL init_date_and_time
 
 !
@@ -2821,5 +2831,6 @@
        LOGICAL      ::  horizontal !< flag indicating treatment of horinzontal surfaces
        
-       REAL(wp) ::  fac_dt     !< interpolation factor  
+       REAL(wp) ::  fac_dt               !< interpolation factor  
+       REAL(wp) ::  second_of_day_init   !< second of the day at model start
 
        TYPE(surf_type), POINTER ::  surf !< pointer on respective surface type, used to generalize routine   
@@ -2827,5 +2838,8 @@
 !
 !--    Calculate current zenith angle
-       CALL calc_zenith
+       CALL get_date_time( time_since_reference_point, &
+                           day_of_year=day_of_year,    &
+                           second_of_day=second_of_day )
+       CALL calc_zenith( day_of_year, second_of_day )
 !
 !--    Interpolate external radiation on current timestep 
@@ -2835,7 +2849,8 @@
           fac_dt = 0
        ELSE
+          CALL get_date_time( 0.0_wp, second_of_day=second_of_day_init )
           t = 0
           DO WHILE ( time_rad_f%var1d(t) <=                                    &
-                     time_since_reference_point + time_utc_init )
+                     time_since_reference_point + second_of_day_init )
              t = t + 1
           ENDDO
@@ -2843,5 +2858,5 @@
           tm = MAX( t-1, 0 )
           
-          fac_dt = ( time_since_reference_point + time_utc_init                &
+          fac_dt = ( time_since_reference_point + second_of_day_init           &
                    - time_rad_f%var1d(tm) + dt_3d )                            &
                  / ( time_rad_f%var1d(t)  - time_rad_f%var1d(tm) )
@@ -3067,11 +3082,10 @@
     SUBROUTINE radiation_clearsky
 
-
        IMPLICIT NONE
 
        INTEGER(iwp) ::  l         !< running index for surface orientation
-       
+
        LOGICAL      ::  horizontal !< flag indicating treatment of horinzontal surfaces
-       
+
        REAL(wp)     ::  pt1       !< potential temperature at first grid level or mean value at urban layer top 
        REAL(wp)     ::  pt1_l     !< potential temperature at first grid level or mean value at urban layer top at local subdomain 
@@ -3083,5 +3097,8 @@
 !
 !--    Calculate current zenith angle
-       CALL calc_zenith
+       CALL get_date_time( time_since_reference_point, &
+                           day_of_year=day_of_year,    &
+                           second_of_day=second_of_day )
+       CALL calc_zenith( day_of_year, second_of_day )
 
 !
@@ -3632,4 +3649,7 @@
            ONLY:  nbgp
 
+       USE palm_date_time_mod,                                                 &
+           ONLY:  hours_per_day
+
        USE particle_attributes,                                                &
            ONLY:  grid_particles, number_of_particles, particles, prt_count
@@ -3642,4 +3662,5 @@
        INTEGER(iwp) ::  k_topo     !< topography top index
 
+       REAL(wp)     ::  d_hours_day  !< 1 / hours-per-day
        REAL(wp)     ::  nc_rad, &    !< number concentration of cloud droplets
                         s_r2,   &    !< weighted sum over all droplets with r^2
@@ -3662,6 +3683,13 @@
 
 !
+!--    Pre-calculate parameters
+       d_hours_day = 1.0_wp / REAL( hours_per_day, KIND=wp )
+
+!
 !--    Calculate current (cosine of) zenith angle and whether the sun is up
-       CALL calc_zenith     
+       CALL get_date_time( time_since_reference_point, &
+                           day_of_year=day_of_year,    &
+                           second_of_day=second_of_day )
+       CALL calc_zenith( day_of_year, second_of_day )
        zenith(0) = cos_zenith
 !
@@ -4548,19 +4576,21 @@
 !> Calculate the cosine of the zenith angle (variable is called zenith)
 !------------------------------------------------------------------------------!
-    SUBROUTINE calc_zenith
+    SUBROUTINE calc_zenith( day_of_year, second_of_day ) 
+
+       USE palm_date_time_mod,                                                 &
+           ONLY:  seconds_per_day
 
        IMPLICIT NONE
 
-       REAL(wp) ::  declination,  & !< solar declination angle
-                    hour_angle      !< solar hour angle
-!
-!--    Calculate current day and time based on the initial values and simulation
-!--    time
-       CALL calc_date_and_time
-
-!
-!--    Calculate solar declination and hour angle   
+       INTEGER(iwp), INTENT(IN) ::  day_of_year    !< day of the year
+
+       REAL(wp)                 ::  declination    !< solar declination angle
+       REAL(wp)                 ::  hour_angle     !< solar hour angle
+       REAL(wp),     INTENT(IN) ::  second_of_day  !< current time of the day in UTC
+
+!
+!--    Calculate solar declination and hour angle
        declination = ASIN( decl_1 * SIN(decl_2 * REAL(day_of_year, KIND=wp) - decl_3) )
-       hour_angle  = 2.0_wp * pi * (time_utc / 86400.0_wp) + lon - pi
+       hour_angle  = 2.0_wp * pi * ( second_of_day / seconds_per_day ) + lon - pi
 
 !
@@ -5417,6 +5447,10 @@
 
      sun_direction = .TRUE.
-     CALL calc_zenith  !< required also for diffusion radiation
-
+     CALL get_date_time( time_since_reference_point, &
+                         day_of_year=day_of_year,    &
+                         second_of_day=second_of_day )
+     CALL calc_zenith( day_of_year, second_of_day ) !< required also for diffusion radiation
+
+!
 !--     prepare rotated normal vectors and irradiance factor
      vnorm(1,:) = kdir(:)
@@ -6240,22 +6274,29 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE calc_diffusion_radiation 
-    
-        INTEGER(iwp)         ::  i                       !< grid index x-direction
-        INTEGER(iwp)         ::  j                       !< grid index y-direction
-        
-        REAL(wp)             ::  year_angle              !< angle
-        REAL(wp)             ::  etr                     !< extraterestrial radiation
-        REAL(wp)             ::  corrected_solarUp       !< corrected solar up radiation
-        REAL(wp)             ::  horizontalETR           !< horizontal extraterestrial radiation
-        REAL(wp)             ::  clearnessIndex          !< clearness index
-        REAL(wp)             ::  diff_frac               !< diffusion fraction of the radiation
-        
-        REAL(wp), PARAMETER  ::  lowest_solarUp = 0.1_wp  !< limit the sun elevation to protect stability of the calculation
-!  
+
+       USE palm_date_time_mod,                                                 &
+           ONLY:  seconds_per_day
+
+       INTEGER(iwp)        ::  i                        !< grid index x-direction
+       INTEGER(iwp)        ::  j                        !< grid index y-direction
+       INTEGER(iwp)        ::  days_per_year            !< days in the current year
+
+       REAL(wp)            ::  clearnessIndex           !< clearness index
+       REAL(wp)            ::  corrected_solarUp        !< corrected solar up radiation
+       REAL(wp)            ::  diff_frac                !< diffusion fraction of the radiation
+       REAL(wp)            ::  etr                      !< extraterestrial radiation
+       REAL(wp)            ::  horizontalETR            !< horizontal extraterestrial radiation
+       REAL(wp), PARAMETER ::  lowest_solarUp = 0.1_wp  !< limit the sun elevation to protect stability of the calculation
+       REAL(wp)            ::  second_of_year           !< current second of the year
+       REAL(wp)            ::  year_angle               !< angle
+
+!
 !--     Calculate current day and time based on the initial values and simulation time
-        year_angle = ( (day_of_year_init * 86400) + time_utc_init              &
-                        + time_since_reference_point )  * d_seconds_year       &
-                        * 2.0_wp * pi
-        
+        CALL get_date_time( time_since_reference_point,      &
+                            second_of_year = second_of_year, &
+                            days_per_year = days_per_year    )
+        year_angle = second_of_year / ( REAL( days_per_year, KIND=wp ) * seconds_per_day ) &
+                   * 2.0_wp * pi
+
         etr = solar_constant * (1.00011_wp +                                   &
                           0.034221_wp * cos(year_angle) +                      &
@@ -6263,5 +6304,5 @@
                           0.000719_wp * cos(2.0_wp * year_angle) +             &
                           0.000077_wp * sin(2.0_wp * year_angle))
-!       
+        
 !--    
 !--     Under a very low angle, we keep extraterestrial radiation at
@@ -8564,10 +8605,8 @@
       IMPLICIT NONE
 
-      INTEGER(iwp)                              ::  it, i, j
-      INTEGER(iwp)                              ::  day_of_month_prev,month_of_year_prev
-      REAL(wp)                                  ::  tsrp_prev
-      REAL(wp)                                  ::  simulated_time_prev
-      REAL(wp), DIMENSION(:,:), ALLOCATABLE     ::  dsidir_tmp       !< dsidir_tmp[:,i] = unit vector of i-th
-                                                                     !< appreant solar direction
+      INTEGER(iwp) ::  it, i, j                           !< loop indices
+
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: dsidir_tmp !< dsidir_tmp[:,i] = unit vector of i-th
+                                                          !< appreant solar direction
 
       ALLOCATE ( dsidir_rev(0:raytrace_discrete_elevs/2-1,                 &
@@ -8577,24 +8616,11 @@
                      raytrace_discrete_elevs/2*raytrace_discrete_azims) )
       ndsidir = 0
-
-!
-!--   We will artificialy update time_since_reference_point and return to
-!--   true value later
-      tsrp_prev = time_since_reference_point
-      simulated_time_prev = simulated_time
-      day_of_month_prev = day_of_month
-      month_of_year_prev = month_of_year
       sun_direction = .TRUE.
-
-!
-!--   initialize the simulated_time
-      simulated_time = 0._wp
+      
 !
 !--   Process spinup time if configured
       IF ( spinup_time > 0._wp )  THEN
          DO  it = 0, CEILING(spinup_time / dt_spinup)
-            time_since_reference_point = -spinup_time + REAL(it, wp) * dt_spinup
-            simulated_time = simulated_time + dt_spinup
-            CALL simulate_pos
+            CALL simulate_pos( it * dt_spinup - spinup_time )
          ENDDO
       ENDIF
@@ -8602,16 +8628,7 @@
 !--   Process simulation time
       DO  it = 0, CEILING(( end_time - spinup_time ) / dt_radiation)
-         time_since_reference_point = REAL(it, wp) * dt_radiation
-         simulated_time = simulated_time + dt_radiation
-         CALL simulate_pos
+         CALL simulate_pos( it * dt_radiation )
       ENDDO
 !
-!--   Return date and time to its original values
-      time_since_reference_point = tsrp_prev
-      simulated_time = simulated_time_prev
-      day_of_month = day_of_month_prev
-      month_of_year = month_of_year_prev
-      CALL init_date_and_time
-
 !--   Allocate global vars which depend on ndsidir
       ALLOCATE ( dsidir ( 3, ndsidir ) )
@@ -8634,9 +8651,13 @@
       !> Simuates a single position
       !------------------------------------------------------------------------!
-      SUBROUTINE simulate_pos
-         IMPLICIT NONE
+      SUBROUTINE simulate_pos( time_since_reference_local )
+
+         REAL(wp), INTENT(IN) ::  time_since_reference_local  !< local time since reference
 !
 !--      Update apparent solar position based on modified t_s_r_p
-         CALL calc_zenith
+         CALL get_date_time( time_since_reference_local, &
+                             day_of_year=day_of_year,    &
+                             second_of_day=second_of_day )
+         CALL calc_zenith( day_of_year, second_of_day )
          IF ( cos_zenith > 0 )  THEN
 !--         
Index: /palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- /palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod and increased binary version
+! 
+! 4146 2019-08-07 07:47:36Z gronemeier
 ! Corrected "Former revisions" section
 ! 
@@ -94,7 +97,4 @@
         ONLY:  cpu_log, log_point_s
 
-    USE date_and_time_mod,                                                     &
-        ONLY:  day_of_year_init, time_utc_init
-
     USE diagnostic_output_quantities_mod,                                      &
         ONLY:  ti_av, uu_av, vv_av, ww_av
@@ -193,5 +193,5 @@
        READ ( 13 )  version_on_file
 
-       binary_version_global = '4.8'
+       binary_version_global = '4.9'
        IF ( TRIM( version_on_file ) /= TRIM( binary_version_global ) )  THEN
           WRITE( message_string, * ) 'version mismatch concerning ',           &
@@ -374,6 +374,6 @@
              CASE ( 'damp_level_1d' )
                 READ ( 13 )  damp_level_1d
-             CASE ( 'day_of_year_init' )
-                READ ( 13 )  day_of_year_init
+             CASE ( 'origin_date_time' )
+                READ ( 13 )  origin_date_time
              CASE ( 'dissipation_1d' )
                 READ ( 13 )  dissipation_1d
@@ -638,6 +638,4 @@
              CASE ( 'time_since_reference_point' )
                 READ ( 13 )  time_since_reference_point
-             CASE ( 'time_utc_init' )
-                READ ( 13 )  time_utc_init
              CASE ( 'time_virtual_measurement' )
                 READ ( 13 )  time_virtual_measurement
Index: /palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- /palm/trunk/SOURCE/salsa_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/salsa_mod.f90	(revision 4227)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4226 2019-09-10 17:03:24Z suehring
 ! Netcdf input routine for dimension length renamed
 ! 
@@ -8385,8 +8388,4 @@
  SUBROUTINE salsa_emission_setup( init )
 
-    USE date_and_time_mod,                                                                         &
-        ONLY:  day_of_month, hour_of_day, index_dd, index_hh, index_mm, month_of_year,             &
-               time_default_indices, time_utc_init
-
     USE netcdf_data_input_mod,                                                                     &
         ONLY:  check_existence, close_input_file, get_attribute, get_variable,                     &
@@ -8394,4 +8393,7 @@
                get_dimension_length, open_read_file, street_type_f
 
+    USE palm_date_time_mod,                                                                        &
+        ONLY:  days_per_week, get_date_time, hours_per_day, months_per_year, seconds_per_hour
+
     USE surface_mod,                                                                               &
         ONLY:  surf_def_h, surf_lsm_h, surf_usm_h
@@ -8403,12 +8405,20 @@
     CHARACTER(LEN=25) ::  mod_name             !< name in the input file
 
-    INTEGER(iwp) ::  i         !< loop index
-    INTEGER(iwp) ::  ib        !< loop index: aerosol number bins
-    INTEGER(iwp) ::  ic        !< loop index: aerosol chemical components
-    INTEGER(iwp) ::  id_salsa  !< NetCDF id of aerosol emission input file
-    INTEGER(iwp) ::  in        !< loop index: emission category
-    INTEGER(iwp) ::  inn       !< loop index
-    INTEGER(iwp) ::  j         !< loop index
-    INTEGER(iwp) ::  ss        !< loop index
+    INTEGER(iwp) ::  day_of_month   !< day of the month
+    INTEGER(iwp) ::  day_of_week    !< day of the week
+    INTEGER(iwp) ::  day_of_year    !< day of the year
+    INTEGER(iwp) ::  hour_of_day    !< hour of the day
+    INTEGER(iwp) ::  i              !< loop index
+    INTEGER(iwp) ::  ib             !< loop index: aerosol number bins
+    INTEGER(iwp) ::  ic             !< loop index: aerosol chemical components
+    INTEGER(iwp) ::  id_salsa       !< NetCDF id of aerosol emission input file
+    INTEGER(iwp) ::  in             !< loop index: emission category
+    INTEGER(iwp) ::  index_dd       !< index day
+    INTEGER(iwp) ::  index_hh       !< index hour
+    INTEGER(iwp) ::  index_mm       !< index month
+    INTEGER(iwp) ::  inn            !< loop index
+    INTEGER(iwp) ::  j              !< loop index
+    INTEGER(iwp) ::  month_of_year  !< month of the year
+    INTEGER(iwp) ::  ss             !< loop index
 
     INTEGER(iwp), DIMENSION(maxspec) ::  cc_i2m   !<
@@ -8417,4 +8427,6 @@
 
     LOGICAL, INTENT(in) ::  init  !< if .TRUE. --> initialisation call
+
+    REAL(wp) ::  second_of_day    !< second of the day
 
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  nsect_emission  !< sectional number emission
@@ -8662,5 +8674,6 @@
 !
 !--             Next emission update
-                next_aero_emission_update = MOD( time_utc_init, 3600.0_wp ) - 3600.0_wp
+                CALL get_date_time( 0.0_wp, second_of_day=second_of_day )
+                next_aero_emission_update = MOD( second_of_day, seconds_per_hour ) - seconds_per_hour
 !
 !--             Get chemical composition (i.e. mass fraction of different species) in aerosols
@@ -8818,5 +8831,7 @@
 !
 !--             Get the index of the current hour
-                CALL time_default_indices( month_of_year, day_of_month, hour_of_day, index_hh )
+                CALL get_date_time( time_since_reference_point, &
+                                    day_of_year=day_of_year, hour=hour_of_day )
+                index_hh = ( day_of_year - 1_iwp ) * hours_per_day + hour_of_day
                 aero_emission_att%time_factor = aero_emission_att%etf(:,index_hh)
 
@@ -8825,6 +8840,23 @@
 !--             Get the index of current hour (index_hh) (TODO: Now "workday" is always assumed.
 !--             Needs to be calculated.)
-                CALL time_default_indices( daytype, month_of_year, day_of_month, hour_of_day,      &
-                                           index_mm, index_dd, index_hh )
+                CALL get_date_time( time_since_reference_point, &
+                                    month=month_of_year,        &
+                                    day=day_of_month,           &
+                                    hour=hour_of_day,           &
+                                    day_of_week=day_of_week     )
+                index_mm = month_of_year
+                index_dd = months_per_year + day_of_week
+                SELECT CASE(TRIM(daytype))
+
+                   CASE ("workday")
+                      index_hh = months_per_year + days_per_week + hour_of_day
+
+                   CASE ("weekend")
+                      index_hh = months_per_year + days_per_week + hours_per_day + hour_of_day
+
+                   CASE ("holiday")
+                      index_hh = months_per_year + days_per_week + 2*hours_per_day + hour_of_day
+
+                END SELECT
                 aero_emission_att%time_factor = aero_emission_att%etf(:,index_mm) *                &
                                                 aero_emission_att%etf(:,index_dd) *                &
@@ -9119,8 +9151,4 @@
  SUBROUTINE salsa_gas_emission_setup( init )
 
-    USE date_and_time_mod,                                                                         &
-        ONLY:  day_of_month, hour_of_day, index_dd, index_hh, index_mm, month_of_year,             &
-               time_default_indices, time_utc_init
-
     USE netcdf_data_input_mod,                                                                     &
         ONLY:  check_existence, close_input_file, get_attribute, get_variable,                     &
@@ -9128,4 +9156,7 @@
                get_dimension_length, open_read_file
 
+    USE palm_date_time_mod,                                                                        &
+        ONLY:  days_per_week, get_date_time, hours_per_day, months_per_year, seconds_per_hour
+
     USE surface_mod,                                                                               &
         ONLY:  surf_def_h, surf_lsm_h, surf_usm_h
@@ -9138,9 +9169,18 @@
     CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE ::  var_names   !<  variable names in input data
 
+
+    INTEGER(iwp) ::  day_of_month   !< day of the month
+    INTEGER(iwp) ::  day_of_week    !< day of the week
+    INTEGER(iwp) ::  day_of_year    !< day of the year
+    INTEGER(iwp) ::  hour_of_day    !< hour of the day
     INTEGER(iwp) ::  id_chem        !< NetCDF id of chemistry emission file
     INTEGER(iwp) ::  i              !< loop index
     INTEGER(iwp) ::  ig             !< loop index
     INTEGER(iwp) ::  in             !< running index for emission categories
+    INTEGER(iwp) ::  index_dd       !< index day
+    INTEGER(iwp) ::  index_hh       !< index hour
+    INTEGER(iwp) ::  index_mm       !< index month
     INTEGER(iwp) ::  j              !< loop index
+    INTEGER(iwp) ::  month_of_year  !< month of the year
     INTEGER(iwp) ::  num_vars       !< number of variables
 
@@ -9148,4 +9188,6 @@
 
     LOGICAL, INTENT(in) ::  init          !< if .TRUE. --> initialisation call
+
+    REAL(wp) ::  second_of_day    !< second of the day
 
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  time_factor  !< emission time factor
@@ -9258,5 +9300,6 @@
 !
 !--       Next emission update
-          next_gas_emission_update = MOD( time_utc_init, 3600.0_wp ) - 3600.0_wp
+          CALL get_date_time( time_since_reference_point, second_of_day=second_of_day )
+          next_gas_emission_update = MOD( second_of_day, seconds_per_hour ) - seconds_per_hour
 !
 !--       Allocate and read surface emission data (in total PM) (NOTE that "preprocessed" input data
@@ -9303,5 +9346,7 @@
 !
 !--       Get the index of the current hour
-          CALL time_default_indices( month_of_year, day_of_month, hour_of_day, index_hh )
+          CALL get_date_time( time_since_reference_point, &
+                              day_of_year=day_of_year, hour=hour_of_day )
+          index_hh = ( day_of_year - 1_iwp ) * hours_per_day + hour_of_day
           time_factor = chem_emission_att%hourly_emis_time_factor(:,index_hh)
 
@@ -9310,6 +9355,23 @@
 !--       Get the index of current hour (index_hh) (TODO: Now "workday" is always assumed.
 !--       Needs to be calculated.)
-          CALL time_default_indices( daytype, month_of_year, day_of_month, hour_of_day,            &
-                                     index_mm, index_dd, index_hh )
+          CALL get_date_time( time_since_reference_point, &
+                              month=month_of_year,        &
+                              day=day_of_month,           &
+                              hour=hour_of_day,           &
+                              day_of_week=day_of_week     )
+          index_mm = month_of_year
+          index_dd = months_per_year + day_of_week
+          SELECT CASE(TRIM(daytype))
+
+             CASE ("workday")
+                index_hh = months_per_year + days_per_week + hour_of_day
+
+             CASE ("weekend")
+                index_hh = months_per_year + days_per_week + hours_per_day + hour_of_day
+
+             CASE ("holiday")
+                index_hh = months_per_year + days_per_week + 2*hours_per_day + hour_of_day
+
+          END SELECT
           time_factor = chem_emission_att%mdh_emis_time_factor(:,index_mm) *                       &
                         chem_emission_att%mdh_emis_time_factor(:,index_dd) *                       &
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 4226)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4226 2019-09-10 17:03:24Z suehring
 ! Changes in interface for the offline nesting
 ! 
@@ -224,7 +227,4 @@
         ONLY:  cpu_log, log_point, log_point_s
 
-    USE date_and_time_mod,                                                                         &
-        ONLY:  calc_date_and_time, hour_call_emis, hour_of_year
-
     USE diagnostic_output_quantities_mod,                                                          &
         ONLY:  doq_calculate,                                                                      &
@@ -272,4 +272,7 @@
         ONLY:  prho_reference
 
+    USE palm_date_time_mod,                                                                        &
+        ONLY:  get_date_time
+
     USE particle_attributes,                                                                       &
         ONLY:  particle_advection, particle_advection_start, use_sgs_for_particles, wang_kernel
@@ -367,12 +370,14 @@
     CHARACTER (LEN=9) ::  time_to_string   !<
 
-    INTEGER(iwp) ::  ib        !< index for aerosol size bins
-    INTEGER(iwp) ::  ic        !< index for aerosol mass bins
-    INTEGER(iwp) ::  icc       !< additional index for aerosol mass bins
-    INTEGER(iwp) ::  ig        !< index for salsa gases
-    INTEGER(iwp) ::  lsp
-    INTEGER(iwp) ::  lsp_usr   !<
-    INTEGER(iwp) ::  mid       !< masked output running index
-    INTEGER(iwp) ::  n         !< loop counter for chemistry species
+    INTEGER(iwp) ::  hour            !< hour of current time
+    INTEGER(iwp) ::  hour_call_emis  !< last hour where emission was called
+    INTEGER(iwp) ::  ib              !< index for aerosol size bins
+    INTEGER(iwp) ::  ic              !< index for aerosol mass bins
+    INTEGER(iwp) ::  icc             !< additional index for aerosol mass bins
+    INTEGER(iwp) ::  ig              !< index for salsa gases
+    INTEGER(iwp) ::  lsp             !<
+    INTEGER(iwp) ::  lsp_usr         !<
+    INTEGER(iwp) ::  mid             !< masked output running index
+    INTEGER(iwp) ::  n               !< loop counter for chemistry species
 
     REAL(wp) ::  dt_3d_old  !< temporary storage of timestep to be used for
@@ -1192,11 +1197,12 @@
        IF ( air_chemistry  .AND.  emissions_anthropogenic )  THEN
 !
-!--       Update the time --> kanani: revise location of this CALL
-          CALL calc_date_and_time
-!
 !--       Call emission routine only once an hour
-          IF ( hour_of_year  >  hour_call_emis )  THEN
+          !> @todo Move check of hour_call_emis into chem_emissions_setup
+          CALL get_date_time( time_since_reference_point, hour=hour )
+          IF ( hour_call_emis /= hour )  THEN
+          !> @question Which of these two if-statements is correct?
+          ! IF ( hour_of_year  >  hour_call_emis )  THEN
              CALL chem_emissions_setup( chem_emis_att, chem_emis, n_matched_vars )
-             hour_call_emis = hour_of_year
+             hour_call_emis = hour
           ENDIF
        ENDIF
@@ -1236,6 +1242,4 @@
        time_since_reference_point = simulated_time - coupling_start_time
        simulated_time_chr         = time_to_string( time_since_reference_point )
-
-
 
 
Index: /palm/trunk/SOURCE/time_integration_spinup.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration_spinup.f90	(revision 4226)
+++ /palm/trunk/SOURCE/time_integration_spinup.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4223 2019-09-10 09:20:47Z gronemeier
 ! Corrected "Former revisions" section
 ! 
@@ -79,13 +82,10 @@
         ONLY:  cpu_log, log_point_s
 
-    USE date_and_time_mod,                                                     &
-        ONLY: day_of_year_init, time_utc_init
-
     USE indices,                                                               &
         ONLY:  nbgp, nzb, nzt, nysg, nyng, nxlg, nxrg
 
-
     USE land_surface_model_mod,                                                &
         ONLY:  lsm_energy_balance, lsm_soil_model, lsm_swap_timelevel
+
     USE pegrid
 
@@ -94,4 +94,7 @@
 
     USE kinds
+
+    USE palm_date_time_mod,                                                    &
+        ONLY:  get_date_time, seconds_per_hour
 
     USE radiation_model_mod,                                                   &
@@ -132,9 +135,11 @@
 
     INTEGER(iwp) :: current_timestep_number_spinup = 0  !< number if timestep during spinup
+    INTEGER(iwp) :: day_of_year                         !< day of the year
   
     LOGICAL :: run_control_header_spinup = .FALSE.  !< flag parameter for steering whether the header information must be output
 
-    REAL(wp) ::  pt_spinup   !< temporary storage of temperature
-    REAL(wp) ::  dt_save     !< temporary storage for time step
+    REAL(wp) ::  pt_spinup      !< temporary storage of temperature
+    REAL(wp) ::  dt_save        !< temporary storage for time step
+    REAL(wp) ::  second_of_day  !< second of the day
                   
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  pt_save  !< temporary storage of temperature
@@ -234,6 +239,10 @@
 !--       shifted by one hour to simulate a lag between air temperature and
 !--       incoming radiation
+          CALL get_date_time( simulated_time - spinup_time - seconds_per_hour, &
+                              day_of_year=day_of_year,                         &
+                              second_of_day=second_of_day                      )
+
           pt_spinup = spinup_pt_mean + spinup_pt_amplitude                     &
-             * solar_angle (time_utc_init + time_since_reference_point - 3600.0)
+                                     * solar_angle(day_of_year, second_of_day)
 
 !
@@ -546,5 +555,7 @@
 !-- Returns the cosine of the solar zenith angle at a given time. This routine
 !-- is similar to that for calculation zenith (see radiation_model_mod.f90)
-    FUNCTION solar_angle( local_time ) 
+    !> @todo Load function calc_zenith of radiation model instead of
+    !>       rewrite the function here.
+    FUNCTION solar_angle( day_of_year, second_of_day ) 
 
        USE basic_constants_and_equations_mod,                                  &
@@ -559,23 +570,14 @@
 
 
-       REAL(wp) ::  solar_angle     !< cosine of the solar zenith angle
-
-       REAL(wp) ::  day             !< day of the year
-       REAL(wp) ::  declination     !< solar declination angle
-       REAL(wp) ::  hour_angle      !< solar hour angle
-       REAL(wp) ::  time_utc        !< current time in UTC
-       REAL(wp), INTENT(IN) :: local_time
-!
-!--    Calculate current day and time based on the initial values and simulation
-!--    time
-
-       day = day_of_year_init + INT(FLOOR( local_time / 86400.0_wp ), KIND=iwp)
-       time_utc = MOD(local_time, 86400.0_wp)
-
-
+       INTEGER(iwp), INTENT(IN) ::  day_of_year  !< day of the year
+
+       REAL(wp)             ::  declination      !< solar declination angle
+       REAL(wp)             ::  hour_angle       !< solar hour angle
+       REAL(wp), INTENT(IN) ::  second_of_day    !< current time of the day in UTC
+       REAL(wp)             ::  solar_angle      !< cosine of the solar zenith angle
 !
 !--    Calculate solar declination and hour angle   
-       declination = ASIN( decl_1 * SIN(decl_2 * REAL(day, KIND=wp) - decl_3) )
-       hour_angle  = 2.0_wp * pi * (time_utc / 86400.0_wp) + lon - pi
+       declination = ASIN( decl_1 * SIN(decl_2 * REAL(day_of_year, KIND=wp) - decl_3) )
+       hour_angle  = 2.0_wp * pi * (second_of_day / 86400.0_wp) + lon - pi
 
 !
@@ -584,5 +586,4 @@
                      * COS(hour_angle)
 
-
     END FUNCTION solar_angle
 
Index: /palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4227)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod
+! 
+! 4214 2019-09-02 15:57:02Z suehring
 ! Bugfix, missing initialization and clearing of soil-moisture tendency 
 ! (J.Resler)
@@ -222,7 +225,4 @@
         ONLY:  cpu_log, log_point, log_point_s
 
-    USE date_and_time_mod,                                                     &
-        ONLY:  time_utc_init
-
     USE grid_variables,                                                        &
         ONLY:  dx, dy, ddx, ddy, ddx2, ddy2
@@ -236,4 +236,7 @@
     USE kinds
               
+    USE palm_date_time_mod,                                                    &
+        ONLY:  get_date_time, seconds_per_hour
+
     USE pegrid
         
@@ -8305,6 +8308,5 @@
 !--        calculation of actual profile coefficient
 !--        ??? check time_since_reference_point ???
-            dtime = mod(simulated_time + time_utc_init, 24.0_wp*3600.0_wp)
-            dhour = INT(dtime/3600.0_wp)
+            CALL get_date_time( time_since_reference_point, hour=dhour, second_of_day=dtime )
 
 !--         TO_DO: activate, if testcase is available
@@ -8319,6 +8321,6 @@
 !--                    given to anthropogenic heat aheat*acoef (W*m-2)
 !--                    linear interpolation of coeficient
-                        acoef = (REAL(dhour+1,wp)-dtime/3600.0_wp)*aheatprof(k,dhour) + &
-                                (dtime/3600.0_wp-REAL(dhour,wp))*aheatprof(k,dhour+1)
+                        acoef = (REAL(dhour+1,wp)-dtime/seconds_per_hour)*aheatprof(k,dhour) + &
+                                (dtime/seconds_per_hour-REAL(dhour,wp))*aheatprof(k,dhour+1)
                         IF ( aheat(k,j,i) > 0.0_wp )  THEN
 !
Index: /palm/trunk/SOURCE/write_restart_data_mod.f90
===================================================================
--- /palm/trunk/SOURCE/write_restart_data_mod.f90	(revision 4226)
+++ /palm/trunk/SOURCE/write_restart_data_mod.f90	(revision 4227)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! implement new palm_date_time_mod and increased binary version
+! 
+! 4146 2019-08-07 07:47:36Z gronemeier
 ! Corrected "Former revisions" section
 ! 
@@ -67,7 +70,4 @@
     USE control_parameters
 
-    USE date_and_time_mod,                                                     &
-        ONLY:  day_of_year_init, time_utc_init
-
     USE grid_variables,                                                        &
         ONLY:  dx, dy
@@ -147,5 +147,5 @@
 
 
-       binary_version_global = '4.8'
+       binary_version_global = '4.9'
 
        CALL wrd_write_string( 'binary_version_global' )
@@ -299,6 +299,6 @@
        WRITE ( 14 )  damp_level_1d
 
-       CALL wrd_write_string( 'day_of_year_init' ) 
-       WRITE ( 14 )  day_of_year_init
+       CALL wrd_write_string( 'origin_date_time' ) 
+       WRITE ( 14 )  origin_date_time
 
        CALL wrd_write_string( 'dissipation_1d' ) 
@@ -679,7 +679,4 @@
        WRITE ( 14 )  time_since_reference_point
 
-       CALL wrd_write_string( 'time_utc_init' ) 
-       WRITE ( 14 )  time_utc_init
-
        CALL wrd_write_string( 'time_virtual_measurement' ) 
        WRITE ( 14 )  time_virtual_measurement
Index: /palm/trunk/TESTS/cases/rans_tkee/INPUT/rans_tkee_p3d
===================================================================
--- /palm/trunk/TESTS/cases/rans_tkee/INPUT/rans_tkee_p3d	(revision 4226)
+++ /palm/trunk/TESTS/cases/rans_tkee/INPUT/rans_tkee_p3d	(revision 4227)
@@ -23,5 +23,5 @@
          topography = 'read_from_file',
 
-         time_utc_init    = 0.0,
+         origin_date_time = '2000-01-01 00:00:00 +00',
 
          turbulence_closure = 'TKE-e',
Index: /palm/trunk/TESTS/cases/urban_environment/INPUT/urban_environment_p3d
===================================================================
--- /palm/trunk/TESTS/cases/urban_environment/INPUT/urban_environment_p3d	(revision 4226)
+++ /palm/trunk/TESTS/cases/urban_environment/INPUT/urban_environment_p3d	(revision 4227)
@@ -37,6 +37,5 @@
     vg_surface           = 0.0,
 
-    day_of_year_init     = 65,             ! march 06, to avoid extreme temperatures
-    time_utc_init        = 36000.0,        ! (0.0 s = 00 UTC midnight),
+    origin_date_time     = '2019-03-06 10:00:00 +00'
 
 !
Index: /palm/trunk/TESTS/cases/urban_environment_restart/INPUT/urban_environment_restart_p3dr
===================================================================
--- /palm/trunk/TESTS/cases/urban_environment_restart/INPUT/urban_environment_restart_p3dr	(revision 4226)
+++ /palm/trunk/TESTS/cases/urban_environment_restart/INPUT/urban_environment_restart_p3dr	(revision 4227)
@@ -36,6 +36,5 @@
     vg_surface           = 0.0,
 
-    day_of_year_init     = 65,             ! march 06, to avoid extreme temperatures
-    time_utc_init        = 36000.0,        ! (0.0 s = 00 UTC midnight),
+    origin_date_time     = '2019-03-06 10:00:00 +00'
 
 !
Index: /palm/trunk/TESTS/cases/urban_environment_salsa/INPUT/urban_environment_salsa_p3d
===================================================================
--- /palm/trunk/TESTS/cases/urban_environment_salsa/INPUT/urban_environment_salsa_p3d	(revision 4226)
+++ /palm/trunk/TESTS/cases/urban_environment_salsa/INPUT/urban_environment_salsa_p3d	(revision 4227)
@@ -37,6 +37,5 @@
     vg_surface           = 0.0,
 
-    day_of_year_init     = 65,             ! march 06, to avoid extreme temperatures
-    time_utc_init        = 36000.0,        ! (0.0 s = 00 UTC midnight),
+    origin_date_time     = '2019-03-06 10:00:00 +00'
 
 !
Index: /palm/trunk/TESTS/cases/urban_environment_salsa/MONITORING/urban_environment_salsa_rc
===================================================================
--- /palm/trunk/TESTS/cases/urban_environment_salsa/MONITORING/urban_environment_salsa_rc	(revision 4226)
+++ /palm/trunk/TESTS/cases/urban_environment_salsa/MONITORING/urban_environment_salsa_rc	(revision 4227)
@@ -1,9 +1,9 @@
 
  ******************************    --------------------------------------------
- * PALM 6.0  Rev: 3915M       *    atmosphere - run without 1D - prerun
+ * PALM 6.0  Rev: 4222M       *    atmosphere - run without 1D - prerun
  ******************************    --------------------------------------------
 
- Date:               2019-07-18    Run:       urban_environment_salsa__gfortran_
- Time:                 11:55:24    Run-No.:   00
+ Date:               2019-09-10    Run:       urban_environment_salsa__gfortran_
+ Time:                 17:55:12    Run-No.:   00
  Run on host:        gfortran_d
  Number of PEs:               4    Processor grid (x,y): (   2,   2) calculated
@@ -145,21 +145,13 @@
        Profile: u, u*2, wu, w*u*, w"u", v, v*2, wv, w*v*, w"v", theta,       
 
-              : theta*2, wtheta, w*theta*, w"theta", q, q*2,                 
+              : theta*2, wtheta, w*theta*, w"theta", q, q*2, salsa_Ntot,     
+
+              : salsa_N_UFP, salsa_LDSA, salsa_PM0.1, salsa_PM2.5, salsa_PM10
+
+              :                                                              
        Output every                60.00 s
        Time averaged over          60.00 s
        Averaging input every        0.00 s
 
-    3D-Arrays:
-       Output format: netCDF 64bit offset                     
-
-
-       Arrays:  u, v, w, Ntot, PM2.5, LDSA, s_OC, g_OCNV, g_OCSV, N_bin3, m_bin4,    
-       Output every                10.00 s  and at the start
-       Upper output limit at       45.00 m  (GP   23)
-
-
-       Number of output time levels allowed: unlimited
-
-
     Time series:
        Output format: netCDF 64bit offset                     
@@ -173,12 +165,12 @@
  -------------------
 
-    Geograph. latitude  :   latitude  = 52.5 degr
-    Geograph. longitude :   longitude = 13.3 degr
+    Geograph. latitude  :   latitude  =  52.5 degr
+    Geograph. longitude :   longitude =  13.3 degr
+    Rotation angle      :   rotation_angle =   0.0 degr
     Angular velocity    :   omega  = 0.729E-04 rad/s
     Coriolis parameter  :   f      =  0.000116 1/s
                             f*     =  0.000089 1/s
 
-    Day of the year at model start :   day_init      =      65
-    UTC time at model start        :   time_utc_init = 36000.0 s
+    Date and time at model start : 2019-03-06 10:00:00 +00
 
     Gravity             :   g      =  9.8 m/s**2
@@ -282,5 +274,5 @@
     Aerosol bin subrange limits (in metres):  3.00E-009 1.00E-008 2.50E-006
     Number of size bins for each aerosol subrange:   1  7
-    Aerosol bin limits (in metres):  3.00E-009 1.00E-008 2.20E-008 4.84E-008 1.07E-007 2.35E-007 5.16E-007 1.14E-006
+    Aerosol bin limits (in metres):  0.00E+000 0.00E+000 0.00E+000 0.00E+000 0.00E+000 0.00E+000 0.00E+000 0.00E+000
     Initial number concentration in bins at the lowest level (#/m**3): 1.19E+008 9.63E+008 5.30E+008 1.96E+008 6.13E+007 6.01E+006 1.95E+005 1.25E+004
 
@@ -343,17 +335,17 @@
   0      5 00:00:05.65   1.1400A   1.5788   1.0336   1.0182  0.091  0.00  -0.495E+00      4.  0.335E+00  0.595E-01  0.514E-02  0.145E-02   16   0   2    6   5  14   15   1  14    0.000    0.000       0
   0      6 00:00:06.79   1.1900A   1.5169   1.0134   0.9996  0.089  0.00  -0.525E+00      4.  0.332E+00  0.606E-01  0.512E-02  0.144E-02   16   0   2    6   5  14   15   1  14    0.000    0.000       0
-  0      7 00:00:07.98   1.2200A   1.4729   0.9879   0.9790  0.088  0.00  -0.546E+00      4.  0.329E+00  0.616E-01  0.522E-02  0.145E-02   16   1  15    6   5  14   15   1  14    0.000    0.000       0
+  0      7 00:00:07.98   1.2200A   1.4729   0.9879   0.9791  0.088  0.00  -0.546E+00      4.  0.329E+00  0.616E-01  0.522E-02  0.145E-02   16   1  15    6   5  14   15   1  14    0.000    0.000       0
   0      8 00:00:09.20   1.2400A   1.4512   0.9609   0.9619  0.087  0.00  -0.537E+00      4.  0.326E+00  0.628E-01  0.527E-02  0.146E-02   16   1  15    6   5  14   15   2  14    0.000    0.000       0
   0      9 00:00:10.44   1.2600A   1.4301   0.9376   0.9485  0.085  0.00  -0.507E+00      4.  0.323E+00  0.640E-01  0.529E-02  0.146E-02   16   1  15   10   5  14   15   2  14    0.000    0.000       0
   0     10 00:00:11.70   1.2800A   1.4106   0.9225   0.9363  0.084  0.00  -0.494E+00      4.  0.321E+00  0.652E-01  0.534E-02  0.146E-02   16   1  15   10   5  14   15   2  14    0.000    0.000       0
   0     11 00:00:12.98   1.2900A   1.3930   0.9100   0.9248  0.083  0.00  -0.491E+00      4.  0.318E+00  0.664E-01  0.542E-02  0.146E-02   16   1  15    3   5  14   15   2  14    0.000    0.000       0
-  0     12 00:00:14.27   1.3100A   1.3775   0.8963   0.9141  0.083  0.00  -0.484E+00      4.  0.316E+00  0.677E-01  0.545E-02  0.145E-02   16   1  15    3   5  14   15   2  14    0.000    0.000       0
+  0     12 00:00:14.27   1.3100A   1.3776   0.8963   0.9141  0.083  0.00  -0.484E+00      4.  0.316E+00  0.677E-01  0.545E-02  0.145E-02   16   1  15    3   5  14   15   2  14    0.000    0.000       0
   0     13 00:00:15.58   1.3200A   1.3623   0.8811   0.9030  0.082  0.00  -0.484E+00      4.  0.313E+00  0.690E-01  0.550E-02  0.146E-02   16   1  15    8   5  14   15   2  14    0.000    0.000       0
-  0     14 00:00:16.90   1.3400A   1.3479   0.8687   0.8921  0.081  0.00  -0.480E+00      4.  0.311E+00  0.704E-01  0.552E-02  0.145E-02   16   1  15    8   5  14   15   2  14    0.000    0.000       0
+  0     14 00:00:16.90   1.3400A   1.3479   0.8688   0.8921  0.081  0.00  -0.480E+00      4.  0.311E+00  0.704E-01  0.552E-02  0.145E-02   16   1  15    8   5  14   15   2  14    0.000    0.000       0
   0     15 00:00:18.24   1.3500A   1.3331   0.8549   0.8804  0.080  0.00  -0.476E+00      4.  0.309E+00  0.717E-01  0.556E-02  0.145E-02   16   1  15    8   5  14   15   2  14    0.000    0.000       0
-  0     16 00:00:19.59   1.3600A   1.3189  -0.8432   0.8687  0.079  0.00  -0.475E+00      4.  0.306E+00  0.731E-01  0.556E-02  0.143E-02   16   1  15    7   3   5   15   2  14    0.000    0.000       0
-  0     17 00:00:20.95   1.3800A   1.3050  -0.8518   0.8567  0.079  0.00  -0.474E+00      4.  0.304E+00  0.744E-01  0.554E-02  0.141E-02   16   1  15    7   3   5   15   2  14    0.000    0.000       0
-  0     18 00:00:22.33   1.3900A   1.2904  -0.8451   0.8440  0.078  0.00  -0.477E+00      4.  0.302E+00  0.758E-01  0.555E-02  0.140E-02   16   1  15    7   3   5   15   2  14    0.000    0.000       0
-  0     19 00:00:23.72   1.4100A   1.2763  -0.8250   0.8316  0.077  0.00  -0.477E+00      4.  0.300E+00  0.772E-01  0.553E-02  0.137E-02   16   1  15    7   3   6   15   2  14    0.000    0.000       0
+  0     16 00:00:19.59   1.3600A   1.3189  -0.8433   0.8687  0.079  0.00  -0.475E+00      4.  0.306E+00  0.731E-01  0.556E-02  0.143E-02   16   1  15    7   3   5   15   2  14    0.000    0.000       0
+  0     17 00:00:20.95   1.3800A   1.3050  -0.8519   0.8567  0.079  0.00  -0.474E+00      4.  0.304E+00  0.744E-01  0.554E-02  0.141E-02   16   1  15    7   3   5   15   2  14    0.000    0.000       0
+  0     18 00:00:22.33   1.3900A   1.2904  -0.8451   0.8441  0.078  0.00  -0.477E+00      4.  0.302E+00  0.758E-01  0.555E-02  0.140E-02   16   1  15    7   3   5   15   2  14    0.000    0.000       0
+  0     19 00:00:23.72   1.4100A   1.2763  -0.8250   0.8317  0.077  0.00  -0.477E+00      4.  0.300E+00  0.772E-01  0.553E-02  0.137E-02   16   1  15    7   3   6   15   2  14    0.000    0.000       0
   0     20 00:00:25.13   1.4300A   1.2618  -0.8139   0.8189  0.077  0.00  -0.481E+00      4.  0.298E+00  0.785E-01  0.552E-02  0.135E-02   16   1  15    7   3   6   15   2  14    0.000    0.000       0
   0     21 00:00:26.56   1.4400A   1.2475   0.7696   0.8062  0.076  0.00  -0.486E+00      4.  0.296E+00  0.799E-01  0.551E-02  0.133E-02   16   1  15   11   5  14   15   2  14    0.000    0.000       0
@@ -361,32 +353,32 @@
   0     23 00:00:29.45   1.4500A   1.2384   0.7470   0.7814  0.076  0.00  -0.471E+00      4.  0.293E+00  0.827E-01  0.540E-02  0.126E-02   10   7   3   12   5  14   15   2  14    0.000    0.000       0
   0     24 00:00:30.90   1.4600A   1.2345   0.7384   0.7685  0.075  0.00  -0.470E+00      6.  0.291E+00  0.841E-01  0.530E-02  0.122E-02   11   7   3   12   5  14   15   2  14    0.000    0.000       0
-  0     25 00:00:32.36   1.4600A   1.2300   0.7299   0.7761  0.075  0.00  -0.470E+00      6.  0.290E+00  0.855E-01  0.523E-02  0.118E-02   11   7   3   12   5  14   10  14   4    0.000    0.000       0
-  0     26 00:00:33.82   1.4600A   1.2308   0.7216   0.8159  0.075  0.00  -0.472E+00      6.  0.288E+00  0.868E-01  0.513E-02  0.113E-02   18   2   5   12   5  14    6   2   5    0.000    0.000       0
-  0     27 00:00:35.28   1.4500A   1.2382   0.7121   0.8578  0.074  0.00  -0.470E+00      6.  0.287E+00  0.882E-01  0.503E-02  0.109E-02   18   2   5   12   5  14   10  14   4    0.000    0.000       0
-  0     28 00:00:36.74   1.4500A   1.2442   0.7006   0.9020  0.074  0.00  -0.471E+00      6.  0.285E+00  0.896E-01  0.492E-02  0.104E-02   18   2   5   12   5  14   10  14   4    0.000    0.000       0
-  0     29 00:00:38.19   1.4400A   1.2487   0.6854   0.9550  0.074  0.00  -0.470E+00      6.  0.284E+00  0.909E-01  0.484E-02  0.100E-02   18   2   5   12   5  14   11  14   4    0.000    0.000       0
-  0     30 00:00:39.63   1.4400A   1.2512   0.6695   1.0071  0.074  0.00  -0.470E+00      6.  0.283E+00  0.923E-01  0.473E-02  0.955E-03   18   2   5   11   5  14   11  14   4    0.000    0.000       0
-  0     31 00:00:41.07   1.4400A   1.2532   0.6498   1.0523  0.074  0.00  -0.471E+00      6.  0.282E+00  0.937E-01  0.466E-02  0.916E-03   18   2   6   11   5  14   11  14   4    0.000    0.000       0
-  0     32 00:00:42.51   1.4300A   1.2566   0.6250   1.0930  0.073  0.00  -0.471E+00      6.  0.281E+00  0.950E-01  0.458E-02  0.878E-03   18   2   6   11   5  14   12  14   4    0.000    0.000       0
-  0     33 00:00:43.94   1.4400A   1.2540  -0.6220   1.1445  0.073  0.00  -0.472E+00      6.  0.281E+00  0.964E-01  0.448E-02  0.835E-03   18   2   6    6   4   9   12  14   4    0.000    0.000       0
-  0     34 00:00:45.38   1.4500A   1.2448  -0.6267   1.1869  0.073  0.00  -0.474E+00      6.  0.280E+00  0.978E-01  0.443E-02  0.800E-03   18   2   6    6   3  10   11  14   3    0.000    0.000       0
-  0     35 00:00:46.83   1.4600A   1.2295  -0.6599   1.2295  0.073  0.00  -0.478E+00      6.  0.279E+00  0.991E-01  0.440E-02  0.762E-03   18   2   6    6   3  10   13  14   4    0.000    0.000       0
-  0     36 00:00:48.29   1.4200A   1.2284  -0.6893   1.2693  0.073  0.00  -0.491E+00      6.  0.279E+00  0.101E+00  0.437E-02  0.722E-03   18   3   6    6   3  10   13  14   4    0.000    0.000       0
-  0     37 00:00:49.71   1.3900A   1.2317  -0.7097   1.2979  0.073  0.00  -0.483E+00      6.  0.278E+00  0.102E+00  0.421E-02  0.664E-03   18   3   6    6   3  10   14  14   4    0.000    0.000       0
-  0     38 00:00:51.10   1.3400A   1.2352  -0.7189   1.3408  0.072  0.00  -0.484E+00      6.  0.278E+00  0.103E+00  0.409E-02  0.610E-03   18   3   7    5   4  10   14  14   4    0.000    0.000       0
-  0     39 00:00:52.44   1.3300A   1.2407  -0.7297   1.3579  0.072  0.00  -0.486E+00     10.  0.278E+00  0.104E+00  0.394E-02  0.555E-03   18   3   7    5   4  10   14  14   4    0.000    0.000       0
-  0     40 00:00:53.77   1.3100A   1.2409  -0.7377   1.3755  0.072  0.00  -0.489E+00     10.  0.277E+00  0.106E+00  0.390E-02  0.518E-03   18   3   7    5   4  10   15  14   4    0.000    0.000       0
-  0     41 00:00:55.08   1.2800A   1.2350  -0.7511   1.4073  0.072  0.00  -0.491E+00     10.  0.277E+00  0.107E+00  0.384E-02  0.482E-03   18   3   7    6   3  11   15  14   4    0.000    0.000       0
-  0     42 00:00:56.36   1.2400A   1.2236  -0.7699   1.4496  0.072  0.00  -0.495E+00     10.  0.277E+00  0.108E+00  0.376E-02  0.447E-03   18   3   7    6   3  11   13  14   4    0.000    0.000       0
-  0     43 00:00:57.60   1.2000A   1.2192  -0.8033   1.5042  0.072  0.00  -0.499E+00     10.  0.277E+00  0.109E+00  0.367E-02  0.412E-03   18   3   8    5   4  11   13  14   4    0.000    0.000       0
-  0     44 00:00:58.80   1.1700A   1.2092  -0.8353   1.5335  0.072  0.00  -0.504E+00     10.  0.277E+00  0.110E+00  0.357E-02  0.381E-03   18   3   8    5   4  11   13  14   4    0.000    0.000       0
-  0     45 00:00:59.97   1.1600A   1.1986  -0.8607   1.5492  0.071  0.00  -0.506E+00     10.  0.277E+00  0.111E+00  0.350E-02  0.357E-03   19   2   8    5   4  11   14  14   4    0.000    0.000       0
+  0     25 00:00:32.36   1.4600A   1.2301   0.7299   0.7760  0.075  0.00  -0.470E+00      6.  0.290E+00  0.855E-01  0.523E-02  0.118E-02   11   7   3   12   5  14   10  14   4    0.000    0.000       0
+  0     26 00:00:33.82   1.4600A   1.2308   0.7216   0.8160  0.075  0.00  -0.472E+00      6.  0.288E+00  0.868E-01  0.513E-02  0.113E-02   18   2   5   12   5  14    6   2   5    0.000    0.000       0
+  0     27 00:00:35.28   1.4500A   1.2382   0.7121   0.8576  0.074  0.00  -0.470E+00      6.  0.287E+00  0.882E-01  0.503E-02  0.109E-02   18   2   5   12   5  14   10  14   4    0.000    0.000       0
+  0     28 00:00:36.74   1.4500A   1.2442   0.7006   0.9018  0.074  0.00  -0.471E+00      6.  0.285E+00  0.896E-01  0.492E-02  0.104E-02   18   2   5   12   5  14   10  14   4    0.000    0.000       0
+  0     29 00:00:38.19   1.4400A   1.2487   0.6854   0.9548  0.074  0.00  -0.470E+00      6.  0.284E+00  0.909E-01  0.484E-02  0.100E-02   18   2   5   12   5  14   11  14   4    0.000    0.000       0
+  0     30 00:00:39.63   1.4400A   1.2512   0.6695   1.0068  0.074  0.00  -0.470E+00      6.  0.283E+00  0.923E-01  0.473E-02  0.955E-03   18   2   5   11   5  14   11  14   4    0.000    0.000       0
+  0     31 00:00:41.07   1.4400A   1.2532   0.6498   1.0521  0.074  0.00  -0.471E+00      6.  0.282E+00  0.937E-01  0.466E-02  0.916E-03   18   2   6   11   5  14   11  14   4    0.000    0.000       0
+  0     32 00:00:42.51   1.4300A   1.2566   0.6250   1.0927  0.073  0.00  -0.472E+00      6.  0.281E+00  0.950E-01  0.458E-02  0.878E-03   18   2   6   11   5  14   12  14   4    0.000    0.000       0
+  0     33 00:00:43.94   1.4400A   1.2540  -0.6221   1.1443  0.073  0.00  -0.472E+00      6.  0.281E+00  0.964E-01  0.448E-02  0.836E-03   18   2   6    6   4   9   12  14   4    0.000    0.000       0
+  0     34 00:00:45.38   1.4500A   1.2448  -0.6268   1.1866  0.073  0.00  -0.474E+00      6.  0.280E+00  0.978E-01  0.443E-02  0.800E-03   18   2   6    6   3  10   11  14   3    0.000    0.000       0
+  0     35 00:00:46.83   1.4600A   1.2295  -0.6599   1.2292  0.073  0.00  -0.478E+00      6.  0.279E+00  0.991E-01  0.440E-02  0.762E-03   18   2   6    6   3  10   13  14   4    0.000    0.000       0
+  0     36 00:00:48.29   1.4200A   1.2284  -0.6893   1.2690  0.073  0.00  -0.491E+00      6.  0.279E+00  0.101E+00  0.437E-02  0.722E-03   18   3   6    6   3  10   13  14   4    0.000    0.000       0
+  0     37 00:00:49.71   1.3900A   1.2317  -0.7097   1.2975  0.073  0.00  -0.483E+00      6.  0.278E+00  0.102E+00  0.421E-02  0.664E-03   18   3   6    6   3  10   14  14   4    0.000    0.000       0
+  0     38 00:00:51.10   1.3400A   1.2352  -0.7189   1.3405  0.072  0.00  -0.484E+00      6.  0.278E+00  0.103E+00  0.409E-02  0.610E-03   18   3   7    5   4  10   14  14   4    0.000    0.000       0
+  0     39 00:00:52.44   1.3300A   1.2407  -0.7297   1.3576  0.072  0.00  -0.486E+00     10.  0.278E+00  0.104E+00  0.394E-02  0.555E-03   18   3   7    5   4  10   14  14   4    0.000    0.000       0
+  0     40 00:00:53.77   1.3100A   1.2409  -0.7377   1.3750  0.072  0.00  -0.489E+00     10.  0.277E+00  0.106E+00  0.390E-02  0.518E-03   18   3   7    5   4  10   15  14   4    0.000    0.000       0
+  0     41 00:00:55.08   1.2800A   1.2350  -0.7511   1.4069  0.072  0.00  -0.491E+00     10.  0.277E+00  0.107E+00  0.384E-02  0.482E-03   18   3   7    6   3  11   15  14   4    0.000    0.000       0
+  0     42 00:00:56.36   1.2400A   1.2236  -0.7700   1.4491  0.072  0.00  -0.495E+00     10.  0.277E+00  0.108E+00  0.376E-02  0.447E-03   18   3   7    6   3  11   13  14   4    0.000    0.000       0
+  0     43 00:00:57.60   1.2000A   1.2191  -0.8032   1.5038  0.072  0.00  -0.499E+00     10.  0.277E+00  0.109E+00  0.367E-02  0.412E-03   18   3   8    5   4  11   13  14   4    0.000    0.000       0
+  0     44 00:00:58.80   1.1700A   1.2092  -0.8353   1.5332  0.072  0.00  -0.504E+00     10.  0.277E+00  0.110E+00  0.357E-02  0.381E-03   18   3   8    5   4  11   13  14   4    0.000    0.000       0
+  0     45 00:00:59.97   1.1600A   1.1987  -0.8607   1.5490  0.071  0.00  -0.506E+00     10.  0.277E+00  0.111E+00  0.350E-02  0.357E-03   19   2   8    5   4  11   14  14   4    0.000    0.000       0
   0     46 00:01:01.13   1.1700A   1.1972  -0.8763   1.5335  0.071  0.00  -0.506E+00     10.  0.276E+00  0.111E+00  0.349E-02  0.341E-03    6   6  10    5   4  11   14  14   4    0.000    0.000       0
-  0     47 00:01:02.30   1.2200A   1.1998  -0.8795   1.4801  0.071  0.00  -0.505E+00     10.  0.276E+00  0.112E+00  0.355E-02  0.333E-03    6   6  10    5   4  11   14  14   4    0.000    0.000       0
-  0     48 00:01:03.52   1.2800A   1.1981  -0.8845   1.4107  0.071  0.00  -0.506E+00     10.  0.276E+00  0.113E+00  0.374E-02  0.340E-03    6   6  10    4   4  11   11  14   5    0.000    0.000       0
-  0     49 00:01:04.80   1.2100A   1.1916  -0.8816   1.4919  0.071  0.00  -0.507E+00     10.  0.276E+00  0.114E+00  0.400E-02  0.356E-03    6   6  10    4   4  11   12  14   5    0.000    0.000       0
-  0     50 00:01:06.01   1.1600A   1.1878  -0.8667   1.5556  0.071  0.00  -0.506E+00     10.  0.276E+00  0.114E+00  0.389E-02  0.348E-03   13  11   9    4   4  11   13  14   5    0.000    0.000       0
-  0     51 00:01:07.17   1.1400A   1.1899  -0.8906   1.5803  0.071  0.07  -0.505E+00     10.  0.276E+00  0.115E+00  0.382E-02  0.342E-03   13  11  10    5   3  12   14  14   5    0.000    0.000       0
-  0     52 00:01:08.31   1.1400A   1.1965  -0.9240   1.5796  0.071  0.09  -0.505E+00     10.  0.275E+00  0.115E+00  0.383E-02  0.342E-03   13  11  10    5   3  12   14  14   5    0.000    0.000       0
-  0     53 00:01:09.45   1.1800A   1.2005  -0.9454   1.5251  0.071  0.10  -0.504E+00     10.  0.275E+00  0.116E+00  0.391E-02  0.350E-03   13  11  10    4   4  12   15  14   5    0.000    0.000       0
-  0     54 00:01:10.63   1.2500A   1.2110  -0.9545   1.4391  0.071  0.10  -0.504E+00     10.  0.275E+00  0.116E+00  0.413E-02  0.370E-03   13  12  11    4   4  12   15  14   5    0.000    0.000       0
+  0     47 00:01:02.30   1.2200A   1.1998  -0.8796   1.4803  0.071  0.00  -0.505E+00     10.  0.276E+00  0.112E+00  0.355E-02  0.333E-03    6   6  10    5   4  11   14  14   4    0.000    0.000       0
+  0     48 00:01:03.52   1.2800A   1.1981  -0.8845   1.4101  0.071  0.00  -0.506E+00     10.  0.276E+00  0.113E+00  0.374E-02  0.340E-03    6   6  10    4   4  11   11  14   5    0.000    0.000       0
+  0     49 00:01:04.80   1.2100A   1.1916  -0.8816   1.4913  0.071  0.00  -0.506E+00     10.  0.276E+00  0.114E+00  0.400E-02  0.356E-03    6   6  10    4   4  11   12  14   5    0.000    0.000       0
+  0     50 00:01:06.01   1.1600A   1.1878  -0.8666   1.5551  0.071  0.00  -0.506E+00     10.  0.276E+00  0.114E+00  0.389E-02  0.348E-03   13  11   9    4   4  11   13  14   5    0.000    0.000       0
+  0     51 00:01:07.17   1.1400A   1.1899  -0.8906   1.5798  0.071  0.07  -0.505E+00     10.  0.276E+00  0.115E+00  0.382E-02  0.342E-03   13  11  10    5   3  12   14  14   5    0.000    0.000       0
+  0     52 00:01:08.31   1.1400A   1.1965  -0.9240   1.5795  0.071  0.09  -0.505E+00     10.  0.275E+00  0.115E+00  0.383E-02  0.342E-03   13  11  10    5   3  12   14  14   5    0.000    0.000       0
+  0     53 00:01:09.45   1.1800A   1.2005  -0.9455   1.5252  0.071  0.10  -0.504E+00     10.  0.275E+00  0.116E+00  0.391E-02  0.350E-03   13  11  10    4   4  12   15  14   5    0.000    0.000       0
+  0     54 00:01:10.63   1.2500A   1.2110  -0.9546   1.4396  0.071  0.10  -0.504E+00     10.  0.275E+00  0.116E+00  0.413E-02  0.370E-03   13  12  11    4   4  12   15  14   5    0.000    0.000       0
