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

19
LINES

< > BotCompany Repo | #1001981 // "time {" (JavaX translator, time a code fragment and print result to System.out)

JavaX translator [tags: use-pretranspiled]

Transpiled version (280L) is out of date.

// Syntax: time { doFunnyStuff(); }

!752

p {
  L<S> tok = tokMainJava();
  
  tok = replaceKeywordBlock(tok,
    // keyword to match
    "time",
    
    // beginning of replacement block
    "{ long __time_startTime = now(); try { ",
    
    // end of replacement block
    "} finally { __time_startTime = now()-__time_startTime; saveTiming(__time_startTime); } }"); 
    
  saveMainJava(tok);
}

Author comment

Began life as a copy of #1001897

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001981
Snippet name: "time {" (JavaX translator, time a code fragment and print result to System.out)
Eternal ID of this version: #1001981/1
Text MD5: 2e90b042ccae1731cf13b28b7943b049
Author: stefan
Category:
Type: JavaX translator
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-01 17:01:22
Source code size: 419 bytes / 19 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 625 / 754
Referenced in: #3000382 - Answer for ferdie (>> t = 1, f = 0)