ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_dateTime::isMorning Interface Reference

Generate and return .true. if the hour in the current or the input time zone (-720 : +840) is Ante Meridiem (before noon). More...

Detailed Description

Generate and return .true. if the hour in the current or the input time zone (-720 : +840) is Ante Meridiem (before noon).

Parameters
[in]zone: The input scalar or array of arbitrary shape of type integer of default kind IK containing the time zone of interest in units of minutes.
(optional, default = the current local time zone.)
[in]julianDay: The input scalar or array of arbitrary shape of type real of default kind RK containing the (possibly proleptic) Julian Day.
(optional, default = the current locale Julian Day.)
Returns
isMorning : The output scalar or array of the same rank as input array-like arguments, of type logical of default kind LK. It is .true. if and only if the current time or the time corresponding to the input zone or julianDay or both represents represents morning.


Possible calling interfaces

real(RK) :: julianDay
logical(LK) :: morning
integer(IK) :: zone
morning = isMorning() ! impure : current local hour
morning = isMorning(zone) ! elemental : current (realtime) hour in the specified time zone
morning = isMorning(julianDay) ! elemental
morning = isMorning(julianDay, zone) ! elemental
!
Generate and return .true. if the hour in the current or the input time zone (-720 : +840) is Ante Me...
This module contains classes and procedures for computing, manipulating, and styling dates and times.
Warning
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds. The procedures under this generic interface are always impure when there is no input argument.
The conditions -12 * 60 < zone and zone < +14 * 60 must hold for the corresponding input arguments.
This condition is verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
Remarks
The procedures under discussion are elemental.
The procedures under this generic interface are non-elemental when there is no input argument.
See also
getMillisecond
getSecond
getMinute
getHour12
getHour
getZone
getZoneAbbr
getDay
getMonth
getYear
isLeapYear


Example usage

1program example
2
3 use pm_kind, only: IK, RK, SK
4 use pm_io, only: display_type
5 use pm_dateTime, only: getDateTime
6 use pm_dateTime, only: isMorning
7
8 implicit none
9
10 type(display_type) :: disp
11 disp = display_type(file = "main.out.F90")
12
13 call disp%skip()
14 call disp%show("getDateTime()")
15 call disp%show( getDateTime() )
16 call disp%show("isMorning() ! is it morning at local time?")
17 call disp%show( isMorning() )
18 call disp%skip()
19
20 call disp%skip()
21 call disp%show("isMorning(0) ! is it morning at UTC?")
22 call disp%show( isMorning(0) )
23 call disp%skip()
24
25 call disp%skip()
26 call disp%show("isMorning(60 * [-12, 3, 14]) ! is it morning in the specified timezones with respect to UTC?")
27 call disp%show( isMorning(60 * [-12, 3, 14]) )
28 call disp%skip()
29
30 call disp%skip()
31 call disp%show("isMorning(-0.5_RK) ! November 24, -4713, start of the day (just after midnight)")
32 call disp%show( isMorning(-0.5_RK) )
33 call disp%skip()
34
35 call disp%skip()
36 call disp%show("isMorning(-0.3_RK) ! November 24, -4713, start of the day (after midnight, before noon)")
37 call disp%show( isMorning(-0.3_RK) )
38 call disp%skip()
39
40 call disp%skip()
41 call disp%show("isMorning(0._RK) ! November 24, -4713, noon (start of JD in Gregorian Calendar)")
42 call disp%show( isMorning(0._RK) )
43 call disp%skip()
44
45 call disp%skip()
46 call disp%show("isMorning(0.5_RK) ! November 25, -4713, start of the day (just after midnight)")
47 call disp%show( isMorning(0.5_RK) )
48 call disp%skip()
49
50 call disp%skip()
51 call disp%show("isMorning(0.5_RK, zone = -6 * 60) ! November 25, -4713, start of the UTC day (just after midnight) but at timezone -6 (Texas) where it is still afternoon")
52 call disp%show( isMorning(0.5_RK, zone = -6 * 60) )
53 call disp%skip()
54
55 call disp%skip()
56 call disp%show("isMorning([2440587.5_RK, 2440587.9_RK, 2444239.49999_RK]) ! morning immediately after midnight, morning before noon, afternoon right before midnight")
57 call disp%show( isMorning([2440587.5_RK, 2440587.9_RK, 2444239.49999_RK]) )
58 call disp%skip()
59
60 call disp%skip()
61 call disp%show("isMorning([2440587.5_RK, 2440587.9_RK, 2444239.49999_RK], zone = 60 * [-1, +14, -12]) ! afternoon near midnight, afternoon the day before UTC, morning right before none at time zone -720")
62 call disp%show( isMorning([2440587.5_RK, 2440587.9_RK, 2444239.49999_RK], zone = 60 * [-1, +14, -12]) )
63 call disp%skip()
64
65end program example
Generate and return the current or the requested date and time as an integer-valued array of size 8 o...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
3+2024, +8, +22, -240, +20, +23, +18, +754
4isMorning() ! is it morning at local time?
5F
6
7
8isMorning(0) ! is it morning at UTC?
9T
10
11
12isMorning(60 * [-12, 3, 14]) ! is it morning in the specified timezones with respect to UTC?
13F, T, F
14
15
16isMorning(-0.5_RK) ! November 24, -4713, start of the day (just after midnight)
17T
18
19
20isMorning(-0.3_RK) ! November 24, -4713, start of the day (after midnight, before noon)
21T
22
23
24isMorning(0._RK) ! November 24, -4713, noon (start of JD in Gregorian Calendar)
25F
26
27
28isMorning(0.5_RK) ! November 25, -4713, start of the day (just after midnight)
29T
30
31
32isMorning(0.5_RK, zone = -6 * 60) ! November 25, -4713, start of the UTC day (just after midnight) but at timezone -6 (Texas) where it is still afternoon
33F
34
35
36isMorning([2440587.5_RK, 2440587.9_RK, 2444239.49999_RK]) ! morning immediately after midnight, morning before noon, afternoon right before midnight
37T, T, F
38
39
40isMorning([2440587.5_RK, 2440587.9_RK, 2444239.49999_RK], zone = 60 * [-1, +14, -12]) ! afternoon near midnight, afternoon the day before UTC, morning right before none at time zone -720
41F, F, T
42
43
Test:
test_pm_dateTime


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, January 30, 2021, 5:36 AM, Dallas, TX

Definition at line 3873 of file pm_dateTime.F90.


The documentation for this interface was generated from the following file: