o
    Íœi7  ã                   @   sœ   d Z ddlZddlmZ zddlmZ W n ey#   ddlmZ Y nw ddlm	Z	 ddl
mZ ejZdZeedejƒZdd	„ Zd
d„ Zdd„ Zdd„ ZdS )z
Utilities.é    N)Útimezone)ÚZoneInfo)Úsettingsi áõÚtemplate_localtimec                 C   sZ   t tddƒrt | ¡rt | tj¡} t ¡ }t | |¡} | S t | ¡r+t | t ¡ ¡} | S )z,Force datatime to have timezone information.ÚUSE_TZF)	Úgetattrr   r   Úis_naiveÚ
make_awareÚdatetime_timezoneÚutcÚget_default_timezoneÚ	localtime)ÚvalueÚ
default_tz© r   úS/var/www/html/philips/venv/lib/python3.10/site-packages/django_celery_beat/utils.pyr	      s   

ýr	   c                   C   s    t tddƒrtt ¡ ƒS t ¡ S )z!Return the current date and time.r   F)r   r   Únow_localtimer   Únowr   r   r   r   r   &   s   r   c                  C   s0   t tddƒr
t ¡ S tt tddƒƒ} tj | ¡S )Nr   TÚ	TIME_ZONEÚUTC)r   r   r   r   r   Údatetime)Ú
project_tzr   r   r   Ú	aware_now.   s   r   c                 C   s6   | sdS ddl m} ddlm} | dkpt|| ƒ|ƒS )z<Return true if Celery is configured to use the db scheduler.Fr   )Úsymbol_by_nameé   )ÚDatabaseSchedulerÚdjango)Úkombu.utilsr   Ú
schedulersr   Ú
issubclass)Ú	schedulerr   r   r   r   r   Úis_database_scheduler8   s   þr!   )Ú__doc__r   r   r
   Úzoneinfor   ÚImportErrorÚbackports.zoneinfoÚdjango.confr   Údjango.utilsÚis_awareÚNEVER_CHECK_TIMEOUTr   r   r   r	   r   r   r!   r   r   r   r   Ú<module>   s"    ÿ
