On 08/25/2015 02:30 PM, Carl Meyer wrote:
> On 08/25/2015 02:24 PM, Alexander Belopolsky wrote:
>>
>> On Tue, Aug 25, 2015 at 4:13 PM, Carl Meyer <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     You are missing the crux of my use case, which is that I need to
>>     generate a calendar to display to the user, with all the half-hour slots
>>     from midnight to midnight for one day in it
>>
>>
>> Got it.  How is this then
>>
>> start = datetime.combine(date, time(0)).astimezone()
>> while True:
>>     end = (start + timedelta(hours=0.5)).astimezone()
>>     print(start, end)
>>     start = end
>>     if end.time() == time(0):
>>         break
> 
> On DST transition days, this code does not generate exactly 48 slots,
> displayable to the user in a schedule that includes all hours from 0 to
> 23 labeled exactly once.
> 
> That introduces an unacceptable level of additional display-layer
> complexity, and remains inferior to the "strict checking" solution I chose.

To further explain this requirement: days can be displayed adjacent to
each other in a weekly view, so the server must provide to the client
exactly 48 slot data structures per day (including DST transition days),
which can be laid out in a strict grid, where all the days share the
same set of time labels on the left.

Carl

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Datetime-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/datetime-sig
The PSF Code of Conduct applies to this mailing list: 
https://www.python.org/psf/codeofconduct/

Reply via email to