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

14
LINES

< > BotCompany Repo | #1026094 // returnTimed - evaluate function and return Timed<A>

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

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

static <A> Timed<A> returnTimed(S desc, IF0<A> f) {
  ret returnTimed(f).description(desc);
}

static <A> Timed<A> returnTimed(IF0<A> f) {
  long time = nanos();
  A a = f.get();
  time = nanos()-time;
  ret Timed(a, nsToMS(time));
}

static Timed<O> returnTimed(Runnable r) {
  ret returnTimed(runnableToIF0(r));
}

Author comment

Began life as a copy of #1009019

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026094
Snippet name: returnTimed - evaluate function and return Timed<A>
Eternal ID of this version: #1026094/11
Text MD5: 72b32752be0a400c29f2ddf8fb025c7d
Transpilation MD5: 071a370c67c937922f0dbef0cb8bf031
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-18 22:28:41
Source code size: 328 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 218 / 343
Version history: 10 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1026095 - returnTimedAfterWarmup
#1030260 - returnPreciselyTimed_repeat - evaluate function n times and return PreciselyTimed<A>