Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8de0601

Browse files
committed
Method to get an event time stamp as milliseconds since the Unix epoch to avoid time zone calculations
1 parentd27d01a commit8de0601

File tree

1 file changed

+6
-4
lines changed
  • src/main/java/io/api/etherscan/model

1 file changed

+6
-4
lines changed

‎src/main/java/io/api/etherscan/model/Log.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,18 @@ public LocalDateTime getTimeStamp() {
6767
}
6868

6969
/**
70-
*
71-
* @return
70+
* Return the "timeStamp" field of the event record as a long-int representing the milliseconds
71+
* since the Unix epoch (1970-01-01 00:00:00).
72+
* @return milliseconds between Unix epoch and `timeStamp`. If field is empty or null, returns null
7273
*/
7374
publicLonggetTimeStampAsMillis() {
7475
if (BasicUtils.isEmpty(timeStamp)) {
7576
returnnull;
7677
}
77-
return (timeStamp.charAt(0) =='0' &&timeStamp.charAt(1) =='x')
78+
longtsSecs = (timeStamp.charAt(0) =='0' &&timeStamp.charAt(1) =='x')
7879
?BasicUtils.parseHex(timeStamp).longValue()
79-
:Long.parseLong(timeStamp) *1000;
80+
:Long.parseLong(timeStamp);
81+
returntsSecs *1000;
8082
}
8183

8284
publicStringgetData() {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp