microseconds epoch time parsing using strptime - epoch

I am using fluentbit for sending logs and the logs have a timestamp like:
__REALTIME_TIMESTAMP : <micro seconds from epoch>
example -
__REALTIME_TIMESTAMP : 1528118184711009
Fluentbit uses strptime to parse the time string. But as I see in the documentation of strptime, I do not see a format string that does the parsing for microseconds from epoch or milliseconds from epoch.
I can only specify the format string in fluentbit.
I was guessing it like "%10s" for only taking the first 10 digits but it doesn't works.
Any help is appreciated.
Thanks in advance.

For posterity:
The %s works fine for even microseconds. It only takes the required number of digits if there is more precision given.

Related

Handle date in LONG format in jmeter

We have below code for "Date" in LONG format in one of the requests in Jmeter
SubmittedDate":{"value":1672986618263}
_CreatedDate":{"value":1672986618264}
Please help me to how to handle to get current date and time in Long format during replay or run time
Thanks
It looks like to be the timestamp in milliseconds since the beginning of Unix epoch, in JMeter there is __time() function which returns current timestamp.
If you want the "CreatedDate" to be 1 millisecond larger than the SubmittedDate you can use __longSum() function
Something like:
SubmittedDate":{"value":${__time(,created)}}
_CreatedDate":{"value":${__longSum(${created},1,)}}
Demo:
More information on JMeter Functions concept: Apache JMeter Functions - An Introduction

Google Spreadsheet time between date - hour calculation

I am at a loss, i looked around the internet and stackoverflow but every so called solution is giving either errors or plainly don't work.
I have the following setup.
4 fields (setup in date dd-mm-yyyy, hour hh:mm:ss) seconds are not important.
start date : 7-1-2020
start hour : 23:30:00
end date : 8-1-2020
end hour : 03:50:00
What i want to happen is to calculate the diffrence in 'hours, minutes' between the end and the start date, hour. But when I calculate and change the end date to lets say 09-01-2020 it does not count the extra 24h at all.
Use Text format:
=text(A3-A1+A4-A2,"[H]:MM")
You need to format the time difference as a duration using the custom format
[h]:mm
for hours and minutes
or
[h]
for whole hours.
There are some good notes on how it works in Excel here and as far as I can tell from testing it Google Sheets is the same.
Alternatively, if I read your question as wanting to drop the minutes and seconds from the times before doing the calculation, you could use
=(B3-B1)*24+hour(B4)-hour(B2)
and just format the result as a normal number.
After alot of fiddeling and this post i came to the conclusion that the main issue was not laying within the mathematical but within the format of the cell.
By default all time values in sheets are 24h max.
So the basic formula =start - end
The time format needed should be
more date time format
elapsed hours : elapsed minutes
apply
Now you should see the correct elapsed hours and minutes

Calculate two date duration in Elastic 6.7 using painless script

I used below simple expression for getting duration:
doc['endTime'].date.millisOfDay - doc['startTime'].date.millisOfDay
But the problem starts when, endTime crosses the startTime day.
Example: If startTime is 23:50 and endTime for the same is 00:12, we
crossed by midnight, which changes the date as well.
In that way I am getting absolutely wrong duration, except all the scenarios when both time lies with in the same day result is as expected.
Help on how exactly i can make this.
You should simply subtract the absolute milliseconds value since the epoch (instead of milliseconds since the start of the day):
doc['endTime'].date.millis - doc['startTime'].date.millis

How to specify time in kaltura api

I am trying to call liveReport service of kaltura but I m not sure how to specify time in the request filters. It asks time to be in int format but when i canver time in milli seconds I get long value, but API is expecting int value.
can anyone provide help in this?
If you are referring to livereports.getreport service then fromTime & toTime properties expect an integer timestamp in seconds. You can also provide a timestamp that is lower then 315360000 seconds and it will be treated relative to NOW, so -1440 will be converted to NOW - 1440
Seems like other report services are expecting an integer that is created using conversion of date format YYYYMMDD to integer, so for May 18th, 2015 you would send 20150318.

ROR + Increase Time Stamp By One Hour

Here, My timestamps code for Ruby is
#{Time.now.utc.strftime("%B #{ActiveSupport::Inflector.ordinalize(Time.now.day)}%Y%R")}".
Now I want to increase my hour by one. So how it can be possible ?
If I understand correctly you can add one hour and then format them to your previous format:
(Time.now+1.hour).utc.strftime("%B #{ActiveSupport::Inflector.ordinalize(Time.now.day)}%Y%R")

Resources