Cast to timevalue before shifting to avoid shifting bits into the bit bucket. Fixes #30. Thanks @parthy.