Added code to detect the right unit (d,m,s)