What is "offsetTimestamp" - flurry

I have a lot of data in Flurry. Inside that, I can see many identical events ( as a json file) they only differ in there offsetTimeStamp.
I there anyone who can help like what is offsetTimeStamp ?
I tried to find many docs but could not get any help

The offsetTimestamp is the start time of the event relative to the session start time in milliseconds.
You can calculate the time the event occurred by summing the session time(t) and the offsetTimestamp(o).
t + o = Time the event occurred in milliseconds since the epoch

Related

Discord.py scheduling with custom time intervals

I am trying to make a bot that sends quotes in servers at different intervals of time (defined by the server admins) by storing the channel id and the time interval (in seconds) inside a db. I managed to get it working for a constant amount of time (say 10 minutes) with #tasks.loop() but I cant figure out how to make it post at different intervals.
Task loops have a method called change_interval which can, as you'd expect, change the interval, you can find out more on here

How to get number of miliseconds since epoch in ADF

I am trying hard to get Unix Timestamp for current time in ADF. Basically I need number of number of milliseconds (ms) since epoch. I tried dabbling with built-in ticks function in ADF but it's not what I need. Also the documentation on the ticks is not really clear. It says number of ticks since specified timestamp is what the function returns. 1 tick = 100 nanoseconds & 1000000 nanoseconds = 1 ms. So considering this, I used the following expression in set variable activity:-
#{ div(ticks('1970-01-01T00:00:00.0000000Z'),10000) }
So the expectation is that whenever I run it, it should give me number of milliseconds since the epoch ( up to the moment of execution ) -- so by this definition every time I run it, it should return me a different value. But it returns a fixed value 62135568000000 every time I run it. So either the documentation is not correct or it's not really calculating what I really need.
Function ticks() return the number of ticks from '0001-01-01T00:00:00.0000000Z' to parameter of ticks(), not from '1970-01-01T00:00:00.0000000Z'.This is why you always get a fixed value 62135568000000.
I have tried #{ticks('0001-01-01T00:00:00.0000000Z')}, result is 0.
So if you want to get ms from '1970-01-01T00:00:00.0000000Z' to current time, you can try this:#{div(sub(ticks(utcnow()),ticks('1970-01-01T00:00:00.0000000Z')),10000)}.

Delay the execution of an expressJS method for 30 days or more

Can the execution of an expressJS method be delayed for 30 days or more just by using setTimeout ?
Let's say I want to create an endpoint /sendMessage that send a message to my other app after a timeout of 30 days. Will my expressJS method execution will last long time enough to fire this message after this delay ?
If your server runs continuously for 30 days or more, then setTimeout() will work for that. But, it is probably not smart to rely on that fact that your server never, ever has to restart.
There are 3rd party programs/modules designed explicitly for this. If you don't want to use one of them, then what I have done in the past is I write each future firing time into a JSON file and I set a timer for it with setTimeout(). If the timer successfully fires, then I remove that time from the JSON file.
So, at any point in time, the JSON file always contains a list of times in the future that I want timers to fire for. Any timer that fires is immediately removed from the JSON file.
Anytime my server starts up, I read the times from the JSON file and reconfigure the setTimeout() for each one.
This way, even if my server restarts, I won't lose any of the timers.
In case you were wondering, the way nodejs creates timers, it does not cost you anything to have a bunch of future timers configured. Nodejs keeps the timers in a sorted linked list and the event loop just checks the time for the next timer to fire - the one at the front of the sorted list (the rest of the timers are not looked at until they get to the front of the sorted list). This means the only time it costs anything to have lots of future timers is when inserting a new timer into the sorted list and there is no regular cost in the event loop to having lots of pending timers present.

NodeJs, handle expiration date for user votes

I'm currently working on a app. This also includes some kind of group chats.
The users inside can make multiple votes, for example for kicking someone. The votes are all valid for 1 week. If all other users submit their opinion the vote gets deleted.So far so good.
I also want a logic, which deletes the vote automatically if it's expired.
So far I got the idea to store the expiration dates for the votes inside a database(MongoDB), sorted by their timestamp of expiration.
In NodeJs I'm always loading the vote with the smallest expiration date from the database.
Then I check how much time is left by subtracting the vote expiration date from the current Date
Date.now() - voteTmp;
Then I can set a timeout, which calls a function to delete the vote and automatically starts a new timeout for the next vote. Is it a problem to set a timeout with such a big number of seconds?
Do you have any better ideas?
Thank you:)
The node.js event loop is explained here:
when the event loop enters a given phase, it will perform any operations specific to that phase, then execute callbacks in that phase's queue until the queue has been exhausted or the maximum number of callbacks has executed.
On each iteration, the event loop checks for scheduled timers that satisfy the specified thresholds (delays) and executes their callbacks. Thus, the magnitude of delays for registered timers shouldn't matter.
However, in your scenario, there's a chance that you might accidentally register redundant or invalid timers (possibly after recovering from a crash). MongoDB supports (automatic) data expiration. You can instruct MongoDB to delete documents after a specified number of seconds has passed. That seems close enough to what you want to do.

Node.js: When does process.hrtime start

What is the starting time for process.hrtime (node.js version of microTime)? I couldn't find any event that starts it. Is the timestamp of the start saved anywhere?
I need my server to be able to get latency to client both ways and for that, I need reliable microtime measure. (+ for some other things)
The starting time is arbitrary; its actual value alone is meaningless. Call hrtime when you want to start the stopwatch, and call it again when your operation is done. Subtract the former from the latter and you have the elapsed time.
process.hrtime()
Returns the current high-resolution real time in a
[seconds, nanoseconds] tuple Array. It is relative to an arbitrary
time in the past. It is not related to the time of day and therefore
not subject to clock drift. The primary use is for measuring
performance between intervals.
You may pass in the result of a previous call to process.hrtime() to
get a diff reading, useful for benchmarks and measuring intervals:

Resources