Added microsecond support and microtime default value
fixes #56
@bcismariu Did you succeed with this PR?
I got the error on fluentbit side, when testing this PR:
[ warn] [input:forward:forward.0] invalid data format, type=4
We needed this for a project we were working on. As far as I remember, this change worked for us.
I am currently no longer working on that project unfortunately can't easily replicate the environment to support you with your question.
Thank you. I believe this PR will work with fluentd, and will not work with fluentbit.
fluentbit expects nanoseconds as msgpack ext type https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v0#eventtime-ext-format Implemented it with https://github.com/rybakit/msgpack.php#custom-types
$secs = $this->time->getTimestamp();
$nanos = (int) $this->time->format('u') * 1000;
$data = \pack('NN', (int) $secs, (int) $nanos);
// https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v0#eventtime-ext-format
return $packer->packExt(0xc7, $data);