Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1033101 // Seconds

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4968L/28K).

srecord Seconds(double seconds) is Comparable<Seconds> {
  double seconds aka get aka getDouble() { ret seconds; }
  
  toString { ret formatDouble(seconds, 3) + " s"; }
  
  public int compareTo(Seconds s) {
    ret cmp(seconds, s.seconds);
  }
  
  Seconds div(double x) { ret Seconds(get()/x); }
  Seconds minus(Seconds x) { ret Seconds(get()-x!); }
}

Author comment

Began life as a copy of #1032953

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033101
Snippet name: Seconds
Eternal ID of this version: #1033101/4
Text MD5: 879e48efbcab99a3d24ce63886462f67
Transpilation MD5: f4df19976b193d45386547a67c8f197a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-23 05:36:13
Source code size: 365 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 178 / 334
Version history: 3 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)