merge from github.com/PuerkitoBio/amber with dynamic function injection for fmttime formating