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

19
LINES

< > BotCompany Repo | #1031686 // TimestampRange

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

Libraryless. Click here for Pure Java version (9258L/51K).

srecord TimestampRange(Timestamp start, Timestamp end) {
  *(long start, long end) {
    this(Timestamp(start), Timestamp(end));
  }
  
  Timestamp start aka startTime() { ret start; }
  Timestamp end aka endTime() { ret end; }
  
  selfType start aka startTime(Timestamp start) { this.start = start; this; }
  selfType end aka endTime(Timestamp end) { this.end = end; this; }
  
  bool complete() { ret start != null && end != null; }
  
  Duration duration() { ret !complete() ? null : end.minusAsDuration(start); }
  
  long length() { ret !complete() ? 0 : end.unixDate()-start.unixDate(); }
  
  toString { ret start + " to " + end; }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031686
Snippet name: TimestampRange
Eternal ID of this version: #1031686/10
Text MD5: 9dad7ed6e36b6759bb1be94cbbbe613c
Transpilation MD5: 464a2014552fd32e649fcc22a036395a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-10 18:23:35
Source code size: 659 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 93 / 316
Version history: 9 change(s)
Referenced in: [show references]