# Path: forsun/status.py
# class ForsunStatus(object):
#     def __init__(self):
#     def inc(self, key, value = 1):
#     def get_info(self):


import time
import signal
import traceback
import logging
import threading
from collections import deque
from .status import forsun_status
# -*- coding: utf-8 -*-
# 15/6/8
# create by: snower


__time_out_callback = None
__exit_callback = None
__queues = deque()
__queue_ready_event = threading.Event()
__is_stop = False
__current_time = int(time.mktime(time.gmtime()))
__time_offset = int(time.time() - __current_time)

def exit_handler(signum, frame):
    __queues.append((__exit_callback, tuple()))
    if not __queue_ready_event.is_set():
        __queue_ready_event.set()
    else:
        forsun_status.timer_loop_ready_error_count += 1

def handler(signum, frame):
    global __current_time
    __current_time = int(time.time() - __time_offset)
    __queues.append((__time_out_callback, (__current_time,)))
    if not __queue_ready_event.is_set():
        __queue_ready_event.set()
    else:

# Path: forsun/status.py
# class ForsunStatus(object):
#     def __init__(self):
#     def inc(self, key, value = 1):
#     def get_info(self):


# Path: forsun/timer.py
import time
import signal
import traceback
import logging
import threading
from collections import deque
from .status import forsun_status

# -*- coding: utf-8 -*-
# 15/6/8
# create by: snower


__time_out_callback = None
__exit_callback = None
__queues = deque()
__queue_ready_event = threading.Event()
__is_stop = False
__current_time = int(time.mktime(time.gmtime()))
__time_offset = int(time.time() - __current_time)

def exit_handler(signum, frame):
    __queues.append((__exit_callback, tuple()))
    if not __queue_ready_event.is_set():
        __queue_ready_event.set()
    else:
        forsun_status.timer_loop_ready_error_count += 1

def handler(signum, frame):
    global __current_time
    __current_time = int(time.time() - __time_offset)
    __queues.append((__time_out_callback, (__current_time,)))
    if not __queue_ready_event.is_set():
        __queue_ready_event.set()
    else:

        forsun_status.timer_loop_ready_error_count += 1