在 Tsung 中,我想以毫秒为单位发布消息时间,我在下面尝试过,但只能以秒为单位获得时间。
<setdynvars sourcetype="eval" code='fun({Pid,DynVars})->
{{Year,Month,Day},{Hour,Minute,Second}} = erlang:localtime(),
io_lib:format('~4..0B-~2..0B-~2..0B::~2..0B:~2..0B:~4..0B\n', [Year,Month,Day,Hour,Minute,Second]) end.'>
<var name="time" />
</setdynvars>
<request subst="true">
<mqtt type="publish" topic="xxx" qos="0" retained="true">%%_time%%</mqtt>
</request>