Support more types to represent a date

This commit is contained in:
Lonami Exo
2017-12-28 12:32:16 +01:00
parent 75a342e24b
commit 3537e9bcc9
2 changed files with 20 additions and 6 deletions

View File

@@ -540,11 +540,7 @@ class TLGenerator:
builder.write('TLObject.serialize_bytes({})'.format(name))
elif 'date' == arg.type: # Custom format
# 0 if datetime is None else int(datetime.timestamp())
builder.write(
r"b'\0\0\0\0' if {0} is None else "
r"struct.pack('<I', int({0}.timestamp()))".format(name)
)
builder.write('TLObject.serialize_datetime({})'.format(name))
else:
# Else it may be a custom type