! { dg-do run }
!
! PR 55548: SYSTEM_CLOCK with integer(8) provides nanosecond resolution, but only microsecond precision (without -lrt)
!
! Contributed by Janus Weil <janus@gcc.gnu.org>

program test_system_clock

  implicit none
  integer(4) :: t4, rate4, cmax4
  integer(8) :: t8, rate8, cmax8
  integer(16) :: t16, rate16, cmax16
  intrinsic :: SYSTEM_CLOCK, HUGE

  ! test integer(4): millisecond resolution
  call SYSTEM_CLOCK (t4, rate4, cmax4)
  if (rate4 /= 1000) call abort
  if (cmax4 /= HUGE(cmax4)) call abort

  ! test integer(8): microsecond resolution
  call SYSTEM_CLOCK (t8, rate8, cmax8)
  if (rate8 /= 1000000) call abort
  if (cmax8 /= HUGE(cmax8)) call abort

  ! test integer(16): nanosecond resolution
  call SYSTEM_CLOCK (t16, rate16, cmax16)
  if (rate16 /= 1000000000) call abort
  if (cmax16 /= HUGE(cmax16)) call abort

end program
