'Converts a :class:`datetime.datetime` object to a (string) integer timestamp
with millisecond precision.'

def cql_encode_datetime(self, val):

    timestamp = calendar.timegm(val.utctimetuple())
    return str(long(((timestamp * 1000.0) + (getattr(val, 'microsecond', 0) / 1000.0))))
