OpenBullet2 icon indicating copy to clipboard operation
OpenBullet2 copied to clipboard

[REQUEST] Milliseconds Support in Time Blocks

Open APT-ZERO opened this issue 3 years ago • 6 comments

image they all not support 13 length unix time / milliseconds

APT-ZERO avatar May 04 '21 11:05 APT-ZERO

Unix time is stored in an int, not a long so this is not possible until the long type is implemented (which is going to take a while).

openbullet avatar May 04 '21 13:05 openbullet

As a workaround for this you can use the following C# snippet (paste it in the LoliCode tab instead of the block you were using).

If your variable is called unixTime and holds the unix time in milliseconds as a string, you can get the date as a string like this

string unixTime = "1620656335000";
string date = RuriLib.Functions.Time.TimeConverter
  .ToDateTimeUtc(long.Parse(unixTime), isMilliseconds: true).ToString();
CLOG YellowGreen $"Converted date to {date}"
data.MarkForCapture(nameof(date));

If it's not in milliseconds, just put false instead of true

openbullet avatar May 10 '21 14:05 openbullet

Is still not available?

AmariLuigi avatar Apr 21 '22 05:04 AmariLuigi

Not yet, I will add this when I have some time. Please be patient, I am very busy with work and this is pretty much the only block that can make use of the long type at the moment

openbullet avatar Apr 23 '22 13:04 openbullet

No worries, just cause doing tests I got into trouble twice cause the post request needs Unix time in milliseconds, but yes, are the first two times that I saw it. Thank you for your answer.

AmariLuigi avatar Apr 23 '22 22:04 AmariLuigi

Usually you will be just fine appending three zeroes at the end (or 3 random digits) for example using interpolation <time>000

openbullet avatar Apr 24 '22 11:04 openbullet