-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nicolaslabbe
committed
Sep 21, 2016
1 parent
0d82a4c
commit d5b5ab2
Showing
6 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import clc from 'cli-color' | ||
|
||
export default class TimeMesure { | ||
|
||
constructor(str) { | ||
this._name = str | ||
console.log('* * * * * * * * * * * * * * * * * * * * * * * * * * * * *') | ||
if(typeof str !== 'undefined' && str !== null) { | ||
console.log('start: ' + clc.green(str)) | ||
} | ||
this._dateStart = new Date() | ||
} | ||
|
||
_msToTime(duration) { | ||
var milliseconds = parseInt((duration%1000)/100) | ||
, seconds = parseInt((duration/1000)%60) | ||
, minutes = parseInt((duration/(1000*60))%60) | ||
, hours = parseInt((duration/(1000*60*60))%24); | ||
|
||
hours = (hours < 10) ? "0" + hours : hours; | ||
minutes = (minutes < 10) ? "0" + minutes : minutes; | ||
seconds = (seconds < 10) ? "0" + seconds : seconds; | ||
|
||
return hours + ":" + minutes + ":" + seconds + "." + milliseconds; | ||
} | ||
|
||
/** | ||
* Get all input from a template | ||
* @return {Array} array of input form | ||
*/ | ||
duration(str) { | ||
var d = new Date(new Date().getTime() - this._dateStart.getTime()).getTime() | ||
console.log('* * * * * * * * * * * * * * * * * * * * * * * * * * * * *') | ||
console.log('d', d) | ||
console.log((this._name ? 'end ' + this._name : "") + "(" + clc.green(this._msToTime(d)) + ") " + (str ? str : "")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import { | |
FileParser, | ||
fileUtils, | ||
folderUtils, | ||
TimeMesure, | ||
getSelectTemplateKeys | ||
} from '../../cli' | ||
|
||
|