Improve strftime detection logic