parse_timezone_offset Function

public pure function parse_timezone_offset(offset, field_width) result(tzo)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: offset
integer, intent(in) :: field_width

Return Value integer


Calls

proc~~parse_timezone_offset~~CallsGraph proc~parse_timezone_offset parse_timezone_offset proc~is_whole_number is_whole_number proc~parse_timezone_offset->proc~is_whole_number proc~read_whole_number read_whole_number proc~parse_timezone_offset->proc~read_whole_number proc~read_whole_number_indexed read_whole_number_indexed proc~read_whole_number->proc~read_whole_number_indexed proc~read_whole_number_indexed->proc~is_whole_number proc~get_integer_digit_from_string get_integer_digit_from_string proc~read_whole_number_indexed->proc~get_integer_digit_from_string proc~get_integer_digit get_integer_digit proc~get_integer_digit_from_string->proc~get_integer_digit

Called by

proc~~parse_timezone_offset~~CalledByGraph proc~parse_timezone_offset parse_timezone_offset proc~parse_time parse_time proc~parse_time->proc~parse_timezone_offset proc~test_parse_timezone_offset test_parse_timezone_offset proc~test_parse_timezone_offset->proc~parse_timezone_offset proc~construct_iso8601time construct_ISO8601Time proc~construct_iso8601time->proc~parse_time proc~test_parse_time test_parse_time proc~test_parse_time->proc~parse_time interface~iso8601time ISO8601Time interface~iso8601time->proc~construct_iso8601time proc~test_construct_iso8601time test_construct_ISO8601Time proc~test_construct_iso8601time->proc~construct_iso8601time

Source Code

   pure function parse_timezone_offset(offset, field_width) result(tzo)
      character(len=*), intent(in) :: offset
      integer, intent(in) :: field_width
      integer :: offset_length
      integer :: tzo
      integer :: minutes
      integer :: hours

      offset_length = len_trim(offset)

      if(offset_length == field_width) then
         ! Offset with hours only
         hours = read_whole_number(offset)
         tzo = hours*MINUTES_PER_HOUR
      elseif (offset_length == 2*field_width) then
         ! Offset with hours and minutes
         hours = read_whole_number(offset(1:field_width))
         minutes = read_whole_number(offset(field_width+1:len(offset)))
         if(is_whole_number(hours) .and. is_whole_number(minutes)) then
            tzo = hours*MINUTES_PER_HOUR + minutes
         else
            tzo = INVALID
         end if
      else
         tzo = INVALID
      end if

   end function parse_timezone_offset