summaryrefslogtreecommitdiff
path: root/lib/streaming_emit.f90
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /lib/streaming_emit.f90
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'lib/streaming_emit.f90')
-rw-r--r--lib/streaming_emit.f9031
1 files changed, 12 insertions, 19 deletions
diff --git a/lib/streaming_emit.f90 b/lib/streaming_emit.f90
index fc86246a..b3346926 100644
--- a/lib/streaming_emit.f90
+++ b/lib/streaming_emit.f90
@@ -13,8 +13,6 @@
! error (version) {"v":1,"t":"error","code":"unknown_schema_version","got":N}
! error (type) {"v":1,"t":"error","code":"configure_type_error",
! "key":"depth","expected":"int","got":"string"}
-! warning {"v":1,"t":"warning","code":"period_boundary_discard",
-! "discarded_samples":N}
!
! Activation: program jt9 calls streaming_emit_set_enabled(.true.) when
! --stream is parsed. Decoder per-mode sites in lib/decoder.f90 query
@@ -38,7 +36,6 @@ module streaming_emit
public :: streaming_emit_error_code
public :: streaming_emit_error_version
public :: streaming_emit_error_type
- public :: streaming_emit_warning_samples
contains
@@ -70,13 +67,14 @@ contains
! dt : DT seconds (float)
! freq : decode frequency offset in Hz (integer)
! msg : decoded message text (gets JSON-escaped + trimmed)
- subroutine streaming_emit_decode(mode_str, nutc, snr, dt, freq, msg)
+ subroutine streaming_emit_decode(mode_str, nutc, snr, dt, freq, msg, utc_is_hhmmss)
character(len=*), intent(in) :: mode_str
integer, intent(in) :: nutc
integer, intent(in) :: snr
real, intent(in) :: dt
integer, intent(in) :: freq
character(len=*), intent(in) :: msg
+ logical, optional, intent(in) :: utc_is_hhmmss
character(len=8) :: time_str
character(len=320) :: msg_escaped
@@ -85,7 +83,7 @@ contains
if (.not. enabled_) return
- call format_utc_(nutc, time_str)
+ call format_utc_(nutc, time_str, utc_is_hhmmss)
call json_escape_(msg, msg_escaped, msg_len)
call format_dt_(dt, dt_str)
@@ -100,11 +98,12 @@ contains
flush(output_unit)
end subroutine streaming_emit_decode
- subroutine streaming_emit_decode_finished(nutc)
+ subroutine streaming_emit_decode_finished(nutc, utc_is_hhmmss)
integer, intent(in) :: nutc
+ logical, optional, intent(in) :: utc_is_hhmmss
character(len=8) :: time_str
if (.not. enabled_) return
- call format_utc_(nutc, time_str)
+ call format_utc_(nutc, time_str, utc_is_hhmmss)
write(output_unit, '(3a)') &
'{"v":1,"t":"decode_finished","period_end":"', trim(time_str), &
'"}'
@@ -166,16 +165,6 @@ contains
flush(output_unit)
end subroutine streaming_emit_error_type
- subroutine streaming_emit_warning_samples(code, discarded_samples)
- character(len=*), intent(in) :: code
- integer(int64), intent(in) :: discarded_samples
- if (.not. enabled_) return
- write(output_unit, '(3a,i0,a)') &
- '{"v":1,"t":"warning","code":"', trim(code), &
- '","discarded_samples":', discarded_samples, '}'
- flush(output_unit)
- end subroutine streaming_emit_warning_samples
-
! Internals -------------------------------------------------------------
! Format dt (real seconds) as a JSON-safe number. gfortran's f0.x format
@@ -198,12 +187,16 @@ contains
! Format the integer nutc time as 6 chars. 4-digit HHMM gets
! zero-extended to HHMM00 so consumers always see a 6-char field.
- subroutine format_utc_(nutc, str)
+ subroutine format_utc_(nutc, str, utc_is_hhmmss)
integer, intent(in) :: nutc
character(len=*), intent(out) :: str
+ logical, optional, intent(in) :: utc_is_hhmmss
integer :: hh, mm, ss
+ logical :: full_time
+ full_time=.false.
+ if(present(utc_is_hhmmss)) full_time=utc_is_hhmmss
str = '000000'
- if (nutc .ge. 100000) then
+ if (full_time.or.nutc.ge.100000) then
hh = nutc / 10000
mm = mod(nutc/100, 100)
ss = mod(nutc, 100)