Inability to use a timestamp with milli/micro seconds

Open
#234 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
backend

Research direction

Read the Client class's formatTime method comment and the message method, where the timestamp is cast to integer. Confirm how microtime(true) is passed through that path, then remove the precision-losing cast. Done means timestamps retain milli- and microsecond precision without changing the existing message behavior.

Written by the indexing model from the issue text.

Description

In the comment of the formatTime method of the Client class it is argued that it is possible to use the result of microtime(true), which is a float. But in the only place where the method is used, in the message method of the same class, the value is cast to integer, making it effectively impossible to pass a timestamp with the precision of milli / micro seconds.

For reference, I saw that the cast was added in this refactoring.

I am going to open a PR to remove the cast to integer.

Dominant language
PHP
Stars
257
Forks
127
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from segmentio/analytics-php

All issues in segmentio/analytics-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.