A numerical integration technique for conservative oscillators combining nonstandard finite-difference methods with a Hamilton's principle