{
    "Function": "toUnixTimestamp",
    "File": "packages/protocol/contracts/automata-attestation/utils/X509DateUtils.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "isLeapYear",
        "isLeapYear"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function toUnixTimestamp(\n        uint16 year,\n        uint8 month,\n        uint8 day,\n        uint8 hour,\n        uint8 minute,\n        uint8 second\n    )\n        internal\n        pure\n        returns (uint256)\n    {\n        uint256 timestamp = 0;\n\n        for (uint16 i = 1970; i < year; ++i) {\n            if (isLeapYear(i)) {\n                timestamp += 31_622_400; // Leap year in seconds\n            } else {\n                timestamp += 31_536_000; // Normal year in seconds\n            }\n        }\n\n        uint8[12] memory monthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n        if (isLeapYear(year)) monthDays[1] = 29;\n\n        for (uint8 i = 1; i < month; ++i) {\n            timestamp += uint256(monthDays[i - 1]) * 86_400; // Days in seconds\n        }\n\n        timestamp += uint256(day - 1) * 86_400; // Days in seconds\n        timestamp += uint256(hour) * 3600; // Hours in seconds\n        timestamp += uint256(minute) * 60; // Minutes in seconds\n        timestamp += second;\n\n        return timestamp;\n    }"
}