Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG] Precision issue using ts_format and ts_strftime in bloblang

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go

Research direction

Start by reproducing the issue's Bloblang mapping with ts_format and ts_strftime using the provided millisecond timestamp and compare the actual and expected outputs. Trace the implementation or entry points for these two methods; done means both preserve the expected millisecond precision without relying on the timestamp offset workaround.

Written by the indexing model from the issue text.

Description

I have encountered a precision issue using ts_format in bloblang mapping.

Input

root.time = (1555234838050/1000).ts_format("2006-01-02T15:04:05.999-07:00", "UTC")

Expected output

{
    "time": "2019-04-14T09:40:38.050+00:00"
}

Actual output

{
    "time": "2019-04-14T09:40:38.049+00:00"
}

Version

4.53.0

The same problem occurs using ts_strftime(). I read that these two methods support nanosecond precision, so ms precision shouldn't be a problem.
PS: I currently use a dirty trick to fix this problem and avoiding heavily string operation at the same time (which is critical for my high frequency use case):

root.time = (1555234838050/1000+0.0004).ts_format("2006-01-02T15:04:05.999-07:00", "UTC")

But I guess this can't be 100% safe as trying to build a feature on a bug.

Dominant language
Go
Stars
573
Forks
122
Avg merge
1d 13h
Merged PRs (30d)
15

Getting set up

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 redpanda-data/benthos

All issues in redpanda-data/benthos

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.