@@ -71,7 +71,8 @@ static inline uint8_t encode_pspdu_sequence(uint8_t *space, uint8_t space_len,
7171
7272void encode_etsili_pshdr (wandder_encoder_t * encoder ,
7373 wandder_etsipshdr_data_t * hdrdata , int64_t cin ,
74- int64_t seqno , struct timeval * tv ) {
74+ int64_t seqno , struct timeval * tv ,
75+ openli_timestamp_encoding_fmt_t timefmt ) {
7576
7677 uint32_t tvclass = 1 ; // timeOfInterception
7778
@@ -120,26 +121,30 @@ void encode_etsili_pshdr(wandder_encoder_t *encoder,
120121 wandder_encode_next (encoder , WANDDER_TAG_INTEGER ,
121122 WANDDER_CLASS_CONTEXT_PRIMITIVE , 4 , & (seqno ),
122123 sizeof (int64_t ));
123- /*
124- wandder_encode_next(encoder, WANDDER_TAG_GENERALTIME,
125- WANDDER_CLASS_CONTEXT_PRIMITIVE, 5, tv,
126- sizeof(struct timeval));
127- */
124+
125+ if (timefmt == OPENLI_ENCODED_TIMESTAMP_GENERALIZED ) {
126+ wandder_encode_next (encoder , WANDDER_TAG_GENERALTIME ,
127+ WANDDER_CLASS_CONTEXT_PRIMITIVE , 5 , tv ,
128+ sizeof (struct timeval ));
129+ }
128130
129131 if (hdrdata -> intpointid ) {
130132 wandder_encode_next (encoder , WANDDER_TAG_PRINTABLE ,
131133 WANDDER_CLASS_CONTEXT_PRIMITIVE , 6 , hdrdata -> intpointid ,
132134 hdrdata -> intpointid_len );
133135 }
134136
135- ENC_CSEQUENCE (encoder , 7 );
136- wandder_encode_next (encoder , WANDDER_TAG_INTEGER ,
137- WANDDER_CLASS_CONTEXT_PRIMITIVE , 0 , & (tv -> tv_sec ),
138- sizeof (tv -> tv_sec ));
139- wandder_encode_next (encoder , WANDDER_TAG_INTEGER ,
140- WANDDER_CLASS_CONTEXT_PRIMITIVE , 1 , & (tv -> tv_usec ),
141- sizeof (tv -> tv_usec ));
142- wandder_encode_endseq (encoder );
137+
138+ if (timefmt == OPENLI_ENCODED_TIMESTAMP_MICROSECONDS ) {
139+ ENC_CSEQUENCE (encoder , 7 );
140+ wandder_encode_next (encoder , WANDDER_TAG_INTEGER ,
141+ WANDDER_CLASS_CONTEXT_PRIMITIVE , 0 , & (tv -> tv_sec ),
142+ sizeof (tv -> tv_sec ));
143+ wandder_encode_next (encoder , WANDDER_TAG_INTEGER ,
144+ WANDDER_CLASS_CONTEXT_PRIMITIVE , 1 , & (tv -> tv_usec ),
145+ sizeof (tv -> tv_usec ));
146+ wandder_encode_endseq (encoder );
147+ }
143148
144149 wandder_encode_next (encoder , WANDDER_TAG_ENUM ,
145150 WANDDER_CLASS_CONTEXT_PRIMITIVE , 8 , & tvclass , sizeof (tvclass ));
0 commit comments