Compare commits

...

4 commits

Author SHA1 Message Date
Lluciocc
2580700ff9
Update time.c 2026-05-12 18:40:27 +02:00
Lluciocc
078ad437a5
Rename 'ptime' command to 'time' in help text 2026-05-12 18:33:08 +02:00
Lluciocc
c275da6145
Rename ptime to time 2026-05-12 18:32:36 +02:00
Lluciocc
0075493fba
Rename object files in Makefile to include 'libc_' prefix 2026-05-12 18:31:25 +02:00
3 changed files with 9 additions and 8 deletions

View file

@ -20,7 +20,7 @@ $(if $(filter doom,$1),$(APP_METADATA_SOURCE_DOOM),$(if $(filter lua,$1),$(APP_M
endef
LIBC_SOURCES = $(wildcard libc/*.c)
LIBC_OBJS = $(patsubst libc/%.c, $(BIN_DIR)/%.o, $(LIBC_SOURCES)) $(BIN_DIR)/crt0.o $(BIN_DIR)/libwidget.o $(BIN_DIR)/stb_image.o
LIBC_OBJS = $(patsubst libc/%.c, $(BIN_DIR)/libc_%.o, $(LIBC_SOURCES)) $(BIN_DIR)/crt0.o $(BIN_DIR)/libwidget.o $(BIN_DIR)/stb_image.o
VPATH = cli gui sys games libc net cli/third_party
vpath %.c cli gui sys games libc net cli/third_party
@ -46,7 +46,7 @@ $(BIN_DIR):
$(BIN_DIR)/crt0.o: crt0.asm
$(AS) -f elf64 $< -o $@
$(BIN_DIR)/%.o: libc/%.c | $(BIN_DIR)
$(BIN_DIR)/libc_%.o: libc/%.c | $(BIN_DIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BIN_DIR)/libwidget.o: ../wm/libwidget.c | $(BIN_DIR)

View file

@ -38,7 +38,7 @@ int main(int argc, char **argv) {
printf("clear - Clear the screen\n");
printf("exit - Exit the terminal\n");
printf("net - Network tools\n");
printf("ptime <cmd> - Measure command execution time\n");
printf("time <cmd> - Measure command execution time\n");
printf("\nHint: Use Ctrl+C to force quit any running application.\n");
return 0;
}

View file

@ -2,7 +2,8 @@
// This software is released under the GNU General Public License v3.0. See LICENSE file for details.
// This header needs to maintain in any file it is present in, as per the GPL license terms.
#include "../libc/stdlib.h"
#include "stdlib.h"
#include "syscall.h"
#define CMDLINE_MAX 512
@ -40,12 +41,12 @@ static int ends_with_elf(const char *s) {
}
static void print_usage(void) {
printf("Usage: ptime <command> [args...]\n");
printf("Usage: time <command> [args...]\n");
printf("\n");
printf("Examples:\n");
printf(" ptime ls\n");
printf(" ptime hexdump file.txt\n");
printf(" ptime /bin/hexdump.elf file.txt\n");
printf(" time ls\n");
printf(" time hexdump file.txt\n");
printf(" time /bin/hexdump.elf file.txt\n");
}
// Read the system uptime in milliseconds by reading /proc/uptime and parsing the first number (seconds).