# Path: fastavro/const.py
# MCS_PER_HOUR = MCS_PER_MINUTE * 60
# 
# MCS_PER_MINUTE = MCS_PER_SECOND * 60
# 
# MCS_PER_SECOND = 1000000
# 
# MLS_PER_HOUR = MLS_PER_MINUTE * 60
# 
# MLS_PER_MINUTE = MLS_PER_SECOND * 60
# 
# MLS_PER_SECOND = 1000
# 
# DAYS_SHIFT = datetime.date(1970, 1, 1).toordinal()


import datetime
import decimal
import os
import time
import uuid
from io import BytesIO
from typing import Dict, Union
from .const import (
    MCS_PER_HOUR,
    MCS_PER_MINUTE,
    MCS_PER_SECOND,
    MLS_PER_HOUR,
    MLS_PER_MINUTE,
    MLS_PER_SECOND,
    DAYS_SHIFT,
)
                int(time.mktime(data.timetuple())) * MCS_PER_SECOND + data.microsecond
            )
    else:
        return data


def prepare_local_timestamp_micros(
    data: Union[datetime.datetime, int], schema: Dict
) -> int:
    """Converts datetime.datetime to int timestamp with microseconds

    The local-timestamp-micros logical type represents a timestamp in a local
    timezone, regardless of what specific time zone is considered local, with a
    precision of one microsecond.
    """
    if isinstance(data, datetime.datetime):
        delta = data.replace(tzinfo=datetime.timezone.utc) - epoch
        return (
            delta.days * 24 * 3600 + delta.seconds
        ) * MCS_PER_SECOND + delta.microseconds
    else:
        return data


def prepare_date(data, schema):
    """Converts datetime.date to int timestamp"""
    if isinstance(data, datetime.date):
        return data.toordinal() - DAYS_SHIFT
    elif isinstance(data, str):
        days = datetime.datetime.strptime(data, "%Y-%m-%d").toordinal()

# Path: fastavro/const.py
# MCS_PER_HOUR = MCS_PER_MINUTE * 60
# 
# MCS_PER_MINUTE = MCS_PER_SECOND * 60
# 
# MCS_PER_SECOND = 1000000
# 
# MLS_PER_HOUR = MLS_PER_MINUTE * 60
# 
# MLS_PER_MINUTE = MLS_PER_SECOND * 60
# 
# MLS_PER_SECOND = 1000
# 
# DAYS_SHIFT = datetime.date(1970, 1, 1).toordinal()


# Path: fastavro/_logical_writers_py.py
import datetime
import decimal
import os
import time
import uuid
from io import BytesIO
from typing import Dict, Union
from .const import (
    MCS_PER_HOUR,
    MCS_PER_MINUTE,
    MCS_PER_SECOND,
    MLS_PER_HOUR,
    MLS_PER_MINUTE,
    MLS_PER_SECOND,
    DAYS_SHIFT,
)

                int(time.mktime(data.timetuple())) * MCS_PER_SECOND + data.microsecond
            )
    else:
        return data


def prepare_local_timestamp_micros(
    data: Union[datetime.datetime, int], schema: Dict
) -> int:
    """Converts datetime.datetime to int timestamp with microseconds

    The local-timestamp-micros logical type represents a timestamp in a local
    timezone, regardless of what specific time zone is considered local, with a
    precision of one microsecond.
    """
    if isinstance(data, datetime.datetime):
        delta = data.replace(tzinfo=datetime.timezone.utc) - epoch
        return (
            delta.days * 24 * 3600 + delta.seconds
        ) * MCS_PER_SECOND + delta.microseconds
    else:
        return data


def prepare_date(data, schema):
    """Converts datetime.date to int timestamp"""
    if isinstance(data, datetime.date):
        return data.toordinal() - DAYS_SHIFT
    elif isinstance(data, str):
        days = datetime.datetime.strptime(data, "%Y-%m-%d").toordinal()

        return days - DAYS_SHIFT