if needed, implement alternative versions for portability. potential code source:
merge interesting functions from ../datetime/scan.c here