{
    "Function": "toTimestamp",
    "File": "packages/protocol/contracts/automata-attestation/utils/X509DateUtils.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "toUnixTimestamp"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function toTimestamp(bytes memory x509Time) internal pure returns (uint256) {\n        uint16 yrs;\n        uint8 mnths;\n        uint8 dys;\n        uint8 hrs;\n        uint8 mins;\n        uint8 secs;\n        uint8 offset;\n\n        if (x509Time.length == 13) {\n            if (uint8(x509Time[0]) - 48 < 5) yrs += 2000;\n            else yrs += 1900;\n        } else {\n            yrs += (uint8(x509Time[0]) - 48) * 1000 + (uint8(x509Time[1]) - 48) * 100;\n            offset = 2;\n        }\n        yrs += (uint8(x509Time[offset + 0]) - 48) * 10 + uint8(x509Time[offset + 1]) - 48;\n        mnths = (uint8(x509Time[offset + 2]) - 48) * 10 + uint8(x509Time[offset + 3]) - 48;\n        dys += (uint8(x509Time[offset + 4]) - 48) * 10 + uint8(x509Time[offset + 5]) - 48;\n        hrs += (uint8(x509Time[offset + 6]) - 48) * 10 + uint8(x509Time[offset + 7]) - 48;\n        mins += (uint8(x509Time[offset + 8]) - 48) * 10 + uint8(x509Time[offset + 9]) - 48;\n        secs += (uint8(x509Time[offset + 10]) - 48) * 10 + uint8(x509Time[offset + 11]) - 48;\n\n        return toUnixTimestamp(yrs, mnths, dys, hrs, mins, secs);\n    }"
}