btime: изменён способ определения временных меток

This commit is contained in:
parent 0e773acb47
commit 1036a12b0f
2 changed files with 8 additions and 11 deletions

View File

@ -23,4 +23,4 @@
### Примеры
```btime -s "Kernel Boot Time: ```
```btime -s "Kernel Boot Time: "```

View File

@ -16,27 +16,24 @@
int main (int argc, char *argv[])
{
int c;
char *dstr = NULL;
uint64_t btime;
uint64_t cycles;
uint64_t cps;
int c;
char *dstr = NULL;
int btime_sec, btime_nsec;
while ( ( c = getopt( argc, argv, "s:" ) ) != -1 )
{
switch ( c )
{
case 's': // be verbose
case 's':
dstr = optarg;
break;
}
}
cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec / 1000;
cycles = ClockCycles();
btime = cycles / cps;
btime_sec = SYSPAGE_ENTRY(qtime)->nsec / 1000000000;
btime_nsec = SYSPAGE_ENTRY(qtime)->nsec / 1000000 % 1000;
printf( "%s %lldms\n", (dstr) ? dstr : "", btime );
printf( "[%3d.%03d c.] %s \n", btime_sec, btime_nsec, (dstr) ? dstr : "");
return ( 0 );
}