# burntsushi/jiff architecture

> Architecture diagram of the GitHub repository burntsushi/jiff, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/burntsushi/jiff
- Repository: https://github.com/burntsushi/jiff

## Overview

##### Main Components

a) Core Library Components:
- Civil Time Module (src/civil/)
- Date handling
- Time handling
- DateTime operations
- ISO Week handling

- Time Zone Management (src/tz/)
- IANA Time Zone Database integration
- Platform-specific implementations
- Offset calculations

- Formatting System (src/fmt/)
- Multiple format implementations (RFC2822, RFC9557, etc.)
- Parsing capabilities
- Serialization support

b) Platform Support Layer:
- Unix support
- Windows support
- Android support
- WASM support

**┌─ Application Layer ─────────────────────┐**
- Public API (Timestamp, Zoned, etc.)     │
- ┤
- Format & Parse Layer                    │
- ┌─────────┐ ┌──────────┐ ┌───────────┐ │
- RFC2822 │ │ Temporal │ │ Strftime  │ │
- ┘ └──────────┘ └───────────┘ │
- ┤
- Core DateTime Operations                │
- ┌─────────┐ ┌──────────┐ ┌───────────┐ │
- Civil  │ │ Duration │ │ Timezone  │ │
- ┘ └──────────┘ └───────────┘ │
- ┤
- Platform Abstraction Layer              │
- ┌───────┐ ┌─────────┐ ┌───────┐ ┌────┐ │
- Unix  │ │Windows  │ │Android│ │WASM│ │
- ┘ └─────────┘ └───────┘ └────┘ │
- ┘

##### Additional Elements

- CLI tools (jiff-cli)
- TZDB generation
- Platform-specific data generation

##### Notes

Notes about:
- Minimum Rust version requirement (1.70.0)
- Feature flags and their effects on the architecture
- Platform-specific behavior differences

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Application Layer"
        API[Public API]:::api
        click API "https://github.com/BurntSushi/jiff/blob/master/src/lib.rs"
        Timestamp[Timestamp]:::core
        click Timestamp "https://github.com/BurntSushi/jiff/blob/master/src/timestamp.rs"
        Zoned[Zoned DateTime]:::core
        click Zoned "https://github.com/BurntSushi/jiff/blob/master/src/zoned.rs"
        Duration[Duration]:::core
        click Duration "https://github.com/BurntSushi/jiff/blob/master/src/duration.rs"
    end

    subgraph "Format & Parse Layer"
        RFC2822[RFC2822]:::format
        click RFC2822 "https://github.com/BurntSushi/jiff/blob/master/src/fmt/rfc2822.rs"
        Temporal[Temporal]:::format
        click Temporal "https://github.com/BurntSushi/jiff/tree/master/src/fmt/temporal/"
        Strftime[Strftime]:::format
        click Strftime "https://github.com/BurntSushi/jiff/tree/master/src/fmt/strtime/"
        Serde[Serde]:::format
        click Serde "https://github.com/BurntSushi/jiff/blob/master/src/fmt/serde.rs"
        RFC9557[RFC9557]:::format
        click RFC9557 "https://github.com/BurntSushi/jiff/blob/master/src/fmt/rfc9557.rs"
    end

    subgraph "Core DateTime Operations"
        CivilTime[Civil Time]:::core
        click CivilTime "https://github.com/BurntSushi/jiff/tree/master/src/civil/"
        Date[Date]:::core
        click Date "https://github.com/BurntSushi/jiff/blob/master/src/civil/date.rs"
        Time[Time]:::core
        click Time "https://github.com/BurntSushi/jiff/blob/master/src/civil/time.rs"
        DateTime[DateTime]:::core
        click DateTime "https://github.com/BurntSushi/jiff/blob/master/src/civil/datetime.rs"
        ISOWeek[ISO Week]:::core
        click ISOWeek "https://github.com/BurntSushi/jiff/blob/master/src/civil/iso_week_date.rs"
        TZ[Time Zone]:::core
        click TZ "https://github.com/BurntSushi/jiff/tree/master/src/tz/"
    end

    subgraph "Platform Abstraction Layer"
        Unix[Unix]:::platform
        click Unix "https://github.com/BurntSushi/jiff/blob/master/src/tz/system/unix.rs"
        Windows[Windows]:::platform
        click Windows "https://github.com/BurntSushi/jiff/tree/master/src/tz/system/windows/"
        Android[Android]:::platform
        click Android "https://github.com/BurntSushi/jiff/blob/master/src/tz/system/android.rs"
        WASM[WASM]:::platform
        click WASM "https://github.com/BurntSushi/jiff/blob/master/src/tz/system/wasm_js.rs"
    end

    subgraph "Build Tools"
        CLI[CLI Tools]:::build
        click CLI "https://github.com/BurntSushi/jiff/tree/master/jiff-cli/"
        TZDBGen[TZDB Generation]:::build
        click TZDBGen "https://github.com/BurntSushi/jiff/blob/master/jiff-cli/cmd/generate/tzdb.rs"
        WinZoneGen[Windows Zone Generation]:::build
        click WinZoneGen "https://github.com/BurntSushi/jiff/blob/master/jiff-cli/cmd/generate/windows_zones.rs"
    end

    %% Relationships
    API --> Timestamp
    API --> Zoned
    API --> Duration

    RFC2822 --> CivilTime
    Temporal --> CivilTime
    Strftime --> CivilTime
    Serde --> CivilTime
    RFC9557 --> CivilTime

    CivilTime --> Date
    CivilTime --> Time
    CivilTime --> DateTime
    CivilTime --> ISOWeek
    CivilTime --> TZ

    TZ --> Unix
    TZ --> Windows
    TZ --> Android
    TZ --> WASM

    CLI --> TZDBGen
    CLI --> WinZoneGen

    %% Styles
    classDef api fill:#f9f,stroke:#333,stroke-width:2px
    classDef core fill:#9cf,stroke:#333,stroke-width:2px
    classDef format fill:#9f9,stroke:#333,stroke-width:2px
    classDef platform fill:#fc9,stroke:#333,stroke-width:2px
    classDef build fill:#ccc,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[API]:::api
        L2[Core Components]:::core
        L3[Format Components]:::format
        L4[Platform Support]:::platform
        L5[Build Tools]:::build
    end
```
