Welcome to The Fiwix Project
A UNIX-like kernel for the i386 architecture
1 /* 2 * fiwix/kernel/syscalls/ftime.c 3 * 4 * Copyright 2018, Jordi Sanfeliu. All rights reserved. 5 * Distributed under the terms of the Fiwix License. 6 */ 7 8 #include <fiwix/kernel.h> 9 #include <fiwix/fs.h> 10 #include <fiwix/timeb.h> 11 #include <fiwix/timer.h> 12 13 #ifdef __DEBUG__ 14 #include <fiwix/stdio.h> 15 #include <fiwix/process.h> 16 #endif /*__DEBUG__ */ 17 18 int sys_ftime(struct timeb *tp) 19 { 20 int errno; 21 22 #ifdef __DEBUG__ 23 printk("(pid %d) sys_ftime()\n", current->pid); 24 #endif /*__DEBUG__ */ 25 26 if((errno = check_user_area(VERIFY_WRITE, tp, sizeof(struct timeb)))) { 27 return errno; 28 } 29 tp->time = CURRENT_TIME; 30 tp->millitm = ((kstat.ticks % HZ) * 1000000) / HZ; 31 /* FIXME: 'timezone' and 'dstflag' fields are not used */ 32 33 return 0; 34 }