1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-28 10:55:43 +00:00
cc65/libsrc/common
Oliver Schmidt 842c151edd Replaced _systime with clock_gettime.
We want to add the capability to not only get the time but also set the time, but there's no "setter" for the "getter" time().

The first ones that come into mind are gettimeofday() and settimeofday(). However, they take a struct timezone argument that doesn't make sense - even the man pages says "The use of the timezone structure is obsolete; the tz argument should normally be specified as NULL." And POSIX says "Applications should use the clock_gettime() function instead of the obsolescent gettimeofday() function."

The ...timeofday() functions work with microseconds while the clock_...time() functions work with nanoseconds. Given that we expect our targets to support only 1/10 of seconds the microseconds look preferable at first sight. However, already microseconds require the cc65 data type 'long' so it's not such a relevant difference to nanoseconds. Additionally clock_getres() seems useful.

In order to avoid code duplication clock_gettime() takes over the role of the actual time getter from _systime(). So time() now calls clock_gettime() instead of _systime().

For some reason beyond my understanding _systime() was mentioned in time.h. _systime() worked exactly like e.g. _sysremove() and those _sys...() functions are all considered internal. The only reason I could see would be a performance gain of bypassing the time() wrapper. However, all known _systime() implementations internally called mktime(). And mktime() is implemented in C using an iterative algorithm so I really can't see what would be left to gain here. From that perspective I decided to just remove _systime().
2018-08-15 16:06:44 +02:00
..
_afailed.c Made _afailed() and uncompress() be fastcall functions. 2015-03-13 07:35:47 -04:00
_cwd.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
_directerrno.s Moved two errno helper functions into separate files. 2015-09-25 14:06:58 -04:00
_environ.s Adjusted constructors. 2016-03-16 16:28:32 +01:00
_fdesc.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_file.h Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
_file.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_fopen.s Use a subroutine to set errno to save some space. 2004-05-13 21:09:08 +00:00
_heap.s Renamed INITBSS to INIT and INIT to ONCE. 2016-03-06 21:27:19 +01:00
_heapadd.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_heapblocksize.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_heapmaxavail.s Have _heapmaxavail() work as advertised. 2014-02-20 21:04:11 +01:00
_heapmemavail.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_hextab.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
_longminstr.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
_mappederrno.s Moved two errno helper functions into separate files. 2015-09-25 14:06:58 -04:00
_oserror.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_poserror.c Fixed comments. No code change. 2011-04-25 18:49:24 +00:00
_printf.h Added explicit settings of calling conventions in pointer-to-function declarations in system and library headers. 2015-06-22 00:15:48 -04:00
_printf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_scanf.c Changed literal zeroes of the style "#>0" into the style "#>$0000". 2014-09-10 19:15:07 -04:00
_scanf.h Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
_scanf.inc Replace vfscanf by an assembler version 2004-11-27 14:56:54 +00:00
_seterrno.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
_swap.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
_sys.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
abort.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
asctime.c
atexit.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
atoi.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
bsearch.c Added explicit settings of calling conventions in pointer-to-function declarations in system and library headers. 2015-06-22 00:15:48 -04:00
calloc.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cc65_idiv32by16r16.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cc65_imul8x8r16.s Added a fast subroutine to multiply two signed 8-bit numbers. 2014-05-11 01:08:27 -04:00
cc65_imul16x16r32.s Working on the division and multiplication routines. 2009-11-04 19:41:54 +00:00
cc65_sincos.s Fixed the return types of the sine/cosine functions. Added comments. 2009-10-30 14:02:24 +00:00
cc65_udiv32by16r16.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
cc65_umul8x8r16.s Fixed the comments to say where the actual Left-Hand Side and Right-Hand Side are put. 2014-05-11 10:43:06 -04:00
cc65_umul16x8r32.s Make the 8x32 unsigned multiplication routine C callable. 2011-07-10 14:52:35 +00:00
cc65_umul16x16r32.s Working on the division and multiplication routines. 2009-11-04 19:41:54 +00:00
chdir.s Renamed oserrcheck to __mappederrno. Added an additional function named 2010-06-10 18:10:53 +00:00
copydata.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
creat.s
ctime.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
divt.s Quick fix for missing _div() adaptation after 95223be. 2018-07-26 10:44:22 +02:00
doesclrscr.s Use 'return0' for default 'doesclrscrafterexit()' implementation in libsrc/common. 2016-06-07 15:05:00 +02:00
errno.s Moved two errno helper functions into separate files. 2015-09-25 14:06:58 -04:00
errormsg.c Implement exec() for Atari XDOS. 2016-06-13 20:40:01 +02:00
fclose.s Use a subroutine to set errno to save some space. 2004-05-13 21:09:08 +00:00
fdopen.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fgetc.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fgetpos.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fgets.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fmisc.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
fopen.s Use a subroutine to set errno to save some space. 2004-05-13 21:09:08 +00:00
fprintf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
fputc.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fputs.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fread.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
free.s Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
freopen.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fscanf.s Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fseek.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fsetpos.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
ftell.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
fwrite.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
getchar.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
getcpu.s Changed #10 to #-basha for clarity. 2018-04-01 13:14:44 -07:00
getcwd.s Fixed comments. 2018-05-21 14:41:12 +02:00
getenv.s Added environment routines 2005-04-21 21:26:15 +00:00
getopt.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
gets.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
gmtime.c "Inverted" time_t value handling. 2018-08-02 17:12:12 +02:00
interrupt.s Save/restore jmpvec as it is used by generated code - see g_callind(). 2017-10-23 18:57:28 +02:00
isalnum.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isalpha.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isblank.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
iscntrl.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isdigit.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isgraph.s Changed literal zeroes of the style "#>0" into the style "#>$0000". 2014-09-10 19:15:07 -04:00
islower.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isprint.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
ispunct.s Changed literal zeroes of the style "#>0" into the style "#>$0000". 2014-09-10 19:15:07 -04:00
isspace.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isupper.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
isxdigit.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
itoa.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
labs.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
locale.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
localtime.c "Inverted" time_t value handling. 2018-08-02 17:12:12 +02:00
longjmp.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
ltoa.s Further optimizations in common/conio. 2018-05-22 16:00:05 +02:00
lz4.s Small lz4 optimizations 2017-06-09 16:57:47 +03:00
malloc.s Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
memchr.s Fixed formatting and two import issues. 2018-05-21 13:02:56 +02:00
memcmp.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
memcpy.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
memmove.s Added further optimizations and unit tests. 2017-03-05 02:09:12 +01:00
memset.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
mkdir.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
mktime.c "Inverted" time_t value handling. 2018-08-02 17:12:12 +02:00
modfree.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
modload.s Use the new declarations from the zeropage include file. In interrupt handlers 2012-11-04 15:23:05 +00:00
perror.c Use _errno, not errno. 2010-06-03 21:31:06 +00:00
pmemalign.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
printf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
putchar.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
putenv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
puts.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
qsort.c Added explicit settings of calling conventions in pointer-to-function declarations in system and library headers. 2015-06-22 00:15:48 -04:00
raise.s
rand.s detectabl > detectable 2017-05-25 03:20:11 -04:00
realloc.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
remove.s Renamed oserrcheck to __mappederrno. Added an additional function named 2010-06-10 18:10:53 +00:00
rename.s Renamed oserrcheck to __mappederrno. Added an additional function named 2010-06-10 18:10:53 +00:00
rewind.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
rmdir.s Renamed oserrcheck to __mappederrno. Added an additional function named 2010-06-10 18:10:53 +00:00
scanf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
searchenv.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
setjmp.s Improved longjmp() and setjmp(). 2015-09-11 14:18:22 -04:00
signal.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
sigtable.s
sleep.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
snprintf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
sprintf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
sscanf.s Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
strcat.s Just some white space fixes of recently contributed code. 2017-04-06 17:53:57 +02:00
strchr.s Just some white space fixes of recently contributed code. 2017-04-06 17:53:57 +02:00
strcmp.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
strcoll.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
strcpy.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
strcspn.s Further optimizations in common/conio. 2018-05-22 16:00:05 +02:00
strdup.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
strerror.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
strftime.c Make some arrays const. 2017-06-28 20:43:31 +02:00
stricmp.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
strlen.s Further optimizations in common/conio. 2018-05-22 16:00:05 +02:00
strlower.s Fixed some return pointers. 2013-08-28 02:58:41 -04:00
strncat.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
strncmp.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
strncpy.s Fixed formatting and two import issues. 2018-05-21 13:02:56 +02:00
strnicmp.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
stroserr.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
strpbrk.s Fixed strpbrk(). 2018-05-29 14:29:50 -04:00
strqtok.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
strrchr.s Added "strrchr" optimizaion a matching unit test and tiny unit test framework. (Documentation for that will follow later) 2017-02-26 20:03:05 +01:00
strspn.s Further optimizations in common/conio. 2018-05-22 16:00:05 +02:00
strstr.s Added "popptr1" which is of common use to save some bytes. 2018-05-20 15:30:18 +02:00
strtoimax.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
strtok.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
strtol.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
strtoul.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
strtoumax.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
strupper.s Fixed some return pointers. 2013-08-28 02:58:41 -04:00
strxfrm.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
system.c Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
tgi_colors.s Moved most of the tgi_colors.s files into the libsrc/common/ directory. 2018-03-27 07:28:46 -04:00
time.s Replaced _systime with clock_gettime. 2018-08-15 16:06:44 +02:00
timezone.c
toascii.s Replaced three (logically) identical files with a single file. 2017-10-23 18:35:06 +02:00
tolower.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
toupper.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
uname.s Renamed oserrcheck to __mappederrno. Added an additional function named 2010-06-10 18:10:53 +00:00
ungetc.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
unlink.s
utscopy.s
vfprintf.s Added explicit settings of calling conventions in pointer-to-function declarations in system and library headers. 2015-06-22 00:15:48 -04:00
vfscanf.s Changed multi-line C comments into another style. 2014-06-30 16:51:07 -04:00
vprintf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
vscanf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
vsnprintf.s Fixed a hardware-stack leak. 2015-07-17 20:36:56 -04:00
vsprintf.s Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
vsscanf.s Changed literal zeroes of the style "#>0" into the style "#>$0000". 2014-09-10 19:15:07 -04:00
zerobss.s Changed run location of INIT segment. 2015-10-14 22:52:09 +02:00