Transpiled version (9194L) is out of date.
srecord Timestamp(long date) implements Comparable<Timestamp> { *() { date = now(); } *(Date date) { if (date != null) this.date = date.getTime(); } long unixDate aka toLong() { ret date; } long unixSeconds() { ret unixDate()/1000; } toString { ret formatLocalDateWithSeconds(date); } // Hmm. Should Timestamp(0) be equal to null? Question, questions... public int compareTo(Timestamp t) { ret t == null ? 1 : cmp(date, t.date); } Timestamp plus(Seconds seconds) { ret plus(seconds?.getDouble()); } Timestamp plus aka plusSeconds(double seconds) { ret Timestamp(date+toMS(seconds)); } // returns milliseconds long minus(Timestamp ts) { ret unixDate()-ts.unixDate(); } long sysTime() { ret clockTimeToSystemTime(date); } Duration minusAsDuration(Timestamp ts) { ret Duration.ofMillis(minus(ts)); } }
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029631 |
Snippet name: | Timestamp |
Eternal ID of this version: | #1029631/16 |
Text MD5: | 7ddc2589713c701c27411d19f3191a09 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-11-26 14:52:09 |
Source code size: | 918 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 216 / 558 |
Version history: | 15 change(s) |
Referenced in: | [show references] |