Skip to content

Instantly share code, notes, and snippets.

@longliveenduro
Last active December 28, 2015 05:38
Show Gist options
  • Select an option

  • Save longliveenduro/7450825 to your computer and use it in GitHub Desktop.

Select an option

Save longliveenduro/7450825 to your computer and use it in GitHub Desktop.
object Conversions {
implicit def thriftToDatetime(dateTime: ThriftDateTime): JodaDateTime = new JodaDateTime(
dateTime.year, dateTime.month, dateTime.day,
dateTime.hour, dateTime.minute, dateTime.second
)
implicit def datetimeToThrift(dateTime: JodaDateTime): ThriftDateTime = ThriftDateTime(
dateTime.getYear().asInstanceOf[Short],
dateTime.getMonthOfYear().asInstanceOf[Byte],
dateTime.getDayOfMonth().asInstanceOf[Byte],
dateTime.getHourOfDay().asInstanceOf[Byte],
dateTime.getMinuteOfHour().asInstanceOf[Byte],
dateTime.getSecondOfMinute().asInstanceOf[Byte]
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment