Skip to content

Commit

Permalink
Minor updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Jul 11, 2024
1 parent 9c6d303 commit 45b527a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/dm_beat.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ module dm_beat

type, public :: beat_type
!! Status message (heartbeat) type.
character(len=NODE_ID_LEN) :: node_id = ' ' !! Node id (`-0-9A-Z_a-z`).
character(len=BEAT_ADDR_LEN) :: address = ' ' !! Client IP address (IPv4, IPv6).
character(len=BEAT_CLIENT_LEN) :: client = ' ' !! Client software name and version.
character(len=TIME_LEN) :: time_sent = TIME_DEFAULT !! Time heartbeat was sent.
character(len=TIME_LEN) :: time_recv = TIME_DEFAULT !! Time heartbeat was received.
integer :: error = E_NONE !! Last client error.
integer :: interval = 0 !! Transmission interval in seconds.
integer :: uptime = 0 !! System uptime in seconds.
character(len=NODE_ID_LEN) :: node_id = ' ' !! Node id (`-0-9A-Z_a-z`).
character(len=BEAT_ADDR_LEN) :: address = ' ' !! Client IP address (IPv4, IPv6).
character(len=BEAT_CLIENT_LEN) :: client = ' ' !! Client software name and version.
character(len=TIME_LEN) :: time_sent = TIME_DEFAULT !! Time heartbeat was sent.
character(len=TIME_LEN) :: time_recv = TIME_DEFAULT !! Time heartbeat was received.
integer :: error = E_NONE !! Last client error.
integer :: interval = 0 !! Transmission interval in seconds.
integer :: uptime = 0 !! System uptime in seconds.
end type beat_type

integer, parameter, public :: BEAT_SIZE = storage_size(beat_type()) / 8 !! Size of `beat_type` in bytes.
Expand Down
10 changes: 6 additions & 4 deletions src/dm_c.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ pure elemental logical function dm_c_f_logical(c) result(f)
!! Converts C logical value to Fortran representation.
integer(kind=c_int), intent(in) :: c

f = .false.
if (c /= 0) f = .true.
f = (c /= 0)
end function dm_c_f_logical

pure elemental integer(kind=c_int) function dm_f_c_logical(f) result(c)
!! Converts Fortran logical value to C representation.
logical, intent(in) :: f

c = 0
if (f) c = 1
if (f) then
c = 1
else
c = 0
end if
end function dm_f_c_logical

pure elemental function dm_int32_to_uint16(s) result(u)
Expand Down

0 comments on commit 45b527a

Please sign in to comment.