Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for unix int timestamps in string values #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jaspeen
Copy link

@jaspeen jaspeen commented Jan 29, 2024

Unix timestamps may come within string field for example in logback lib(widely used java) json formatter - ch.qos.logback.contrib.json.classic.JsonLayout

This will try to parse number when no other time formats succeed

@aybabtme
Copy link
Collaborator

aybabtme commented Apr 1, 2024

Hi @jaspeen, is this timestamp format always an integer or can it be a float?

@jaspeen
Copy link
Author

jaspeen commented Apr 1, 2024

@aybabtme In case of logback it is 64 bit integer with ms since the epoch

if err == nil {
return t, true
}
}
// try to parse unix time number from string
floatVal, err := strconv.ParseFloat(typedVal, 64)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case shouldn't this parse an int?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants