MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / sectionTimer

Function sectionTimer

services.ts:907–957  ·  view source on GitHub ↗
(input:string)

Source from the content-addressed store, hash-verified

905 console.log("");
906 },
907 sectionTimer = function node_apps_build_sectionTime(input:string):void {
908 let now:string[] = input.replace(`${text.cyan}[`, "").replace(`]${text.none} `, "").split(":"),
909 numb:[number, number] = [(Number(now[0]) * 3600) + (Number(now[1]) * 60) + Number(now[2].split(".")[0]), Number(now[2].split(".")[1])],
910 difference:[number, number],
911 times:string[] = [],
912 time:number = 0,
913 str:string = "";
914 difference = [numb[0] - sectionTime[0], (numb[1] + 1000000000) - (sectionTime[1] + 1000000000)];
915 sectionTime = numb;
916 if (difference[1] < 0) {
917 difference[0] = difference[0] - 1;
918 difference[1] = difference[1] + 1000000000;
919 }
920 if (difference[0] < 3600) {
921 times.push("00");
922 } else {
923 time = Math.floor(difference[0] / 3600);
924 difference[0] = difference[0] - (time * 3600);
925 if (time < 10) {
926 times.push(`0${time}`);
927 } else {
928 times.push(String(time));
929 }
930 }
931 if (difference[0] < 60) {
932 times.push("00");
933 } else {
934 time = Math.floor(difference[0] / 60);
935 difference[0] = difference[0] - (time * 60);
936 if (time < 10) {
937 times.push(`0${time}`);
938 } else {
939 times.push(String(time));
940 }
941 }
942 if (difference[0] < 1) {
943 times.push("00");
944 } else if (difference[0] < 10) {
945 times.push(`0${difference[0]}`);
946 } else {
947 times.push(String(difference[0]));
948 }
949 str = String(difference[1]);
950 if (str.length < 9) {
951 do {
952 str = `0${str}`;
953 } while (str.length < 9);
954 }
955 times[2] = `${times[2]}.${str}`;
956 console.log(`${text.cyan + text.bold}[${times.join(":")}]${text.none} ${text.green}Total section time.${text.none}`);
957 },
958 next = function node_apps_build_next(message:string):void {
959 let phase = order[type][0],
960 time:string = apps.humantime(false);

Callers 1

nextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected