this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

optimize moooooooore

alice ba37f2d7 4800902e

+362 -139
+31 -32
scripts/generateAirportTzList.ts
··· 454 454 cContent += `// Year-specific DST data for ${year}\n\n`; 455 455 cContent += `#include <stdint.h>\n\n`; 456 456 457 - // Airport Code Pool (3-letter IATA codes) 458 - cContent += `// Total airport codes: ${codePool.length}\n`; 459 - cContent += `static const char airport_code_pool[] =\n`; 460 - if (codePool.length > 0) { 461 - for (let i = 0; i < codePool.length; i++) { 462 - if (i % 8 === 0) cContent += ` `; // Indent 463 - cContent += `"${codePool[i]}"`; 464 - if ((i + 1) % 8 === 0 || i === codePool.length - 1) { 465 - cContent += `\n`; 466 - } else { 467 - cContent += ` `; 468 - } 469 - } 470 - cContent += `;\n\n`; 471 - } else { 472 - cContent += ` ""; // Empty pool\n`; 473 - cContent += `; 457 + // Airport Code Pool (bit-packed 15 bits/code) 458 + cContent += `// Total airport codes: ${codePool.length} (codes listed for debug)\n`; 459 + cContent += `// Codes: ${codePool.join(', ')}\n`; 460 + cContent += `static const uint16_t airport_code_pool_bits[] = {\n`; 461 + for (const code of codePool) { 462 + // pack each letter A-Z into 5 bits 463 + const b0 = code.charCodeAt(0) - 65; 464 + const b1 = code.charCodeAt(1) - 65; 465 + const b2 = code.charCodeAt(2) - 65; 466 + const bits = (b0 << 10) | (b1 << 5) | b2; 467 + cContent += ` 0x${bits.toString(16)}, /* ${code} */\n`; 468 + } 469 + cContent += `};\n\n`; 474 470 475 - `; 476 - } 471 + // Count of bit-packed airport codes 472 + cContent += `#define AIRPORT_CODE_POOL_BITS_COUNT ${codePool.length}\n\n`; 477 473 478 474 // Airport Name Pool (pointers to strings) 479 475 cContent += `// Total airport names: ${namePool.length}\n`; ··· 498 494 cContent += ` "\0"; // Empty pool\n\n`; 499 495 } 500 496 501 - // TzInfo struct definition 497 + // Packed TzInfo struct: quarter-hours and 32-bit UTC 502 498 cContent += `typedef struct {\n`; 503 - cContent += ` float std_offset_hours;\n`; 504 - cContent += ` float dst_offset_hours;\n`; 505 - cContent += ` int64_t dst_start_utc;\n`; 506 - cContent += ` int64_t dst_end_utc;\n`; 507 - cContent += ` int name_offset; // Index into airport_code_pool & airport_name_pool\n`; 508 - cContent += ` int name_count; // Number of unique airports for this tz variant\n`; 499 + cContent += ` int8_t std_quarters; // std offset in 0.25h units\n`; 500 + cContent += ` int8_t dst_quarters; // dst offset in 0.25h units\n`; 501 + cContent += ` int32_t dst_start_utc; // DST start (seconds since epoch)\n`; 502 + cContent += ` int32_t dst_end_utc; // DST end (seconds since epoch)\n`; 503 + cContent += ` uint16_t name_offset; // Index into airport_name_pool\n`; 504 + cContent += ` uint8_t name_count; // Number of codes in this bucket\n`; 509 505 cContent += `} TzInfo;\n\n`; 510 506 511 - // airport_tz_list array initialization 507 + // airport_tz_list array: packed quarters and 32-bit DST timestamps 512 508 cContent += `// Total timezone variants: ${sortedBuckets.length}\n`; 513 509 cContent += `static const TzInfo airport_tz_list[] = {\n`; 514 510 if (sortedBuckets.length > 0) { 515 511 for (const bucket of sortedBuckets) { 516 - const std_h = bucket.std / 3600.0; 517 - const dst_h = bucket.dst / 3600.0; 518 - // Escape any backslashes potentially in timezone names for the comment 519 - const tzComment = Array.from(bucket.tzNames).slice(0,3).join(', ').replace(/\\/g, '\\'); 520 - cContent += ` { ${std_h.toFixed(2)}f, ${dst_h.toFixed(2)}f, ${bucket.start}LL, ${bucket.end}LL, ${bucket.offset ?? 0}, ${bucket.count ?? 0} }, // ${tzComment}...\n`; 512 + // pack standard/dst offsets: seconds -> quarter-hours (900s) 513 + const stdQ = Math.round(bucket.std / 900); 514 + const dstQ = Math.round(bucket.dst / 900); 515 + // original hours for debug 516 + const std_h = (bucket.std / 3600.0).toFixed(2); 517 + const dst_h = (bucket.dst / 3600.0).toFixed(2); 518 + const tzComment = Array.from(bucket.tzNames).slice(0,3).join(', '); 519 + cContent += ` { ${stdQ}, ${dstQ}, ${bucket.start}, ${bucket.end}, ${bucket.offset ?? 0}, ${bucket.count ?? 0} }, // ${tzComment} (${std_h}h/${dst_h}h)\n`; 521 520 } 522 521 } else { 523 522 cContent += ` // Empty list\n`;
+318 -101
src/c/airport_tz_list.c
··· 1 1 // Auto-generated by generateAirportTzList.ts 2 - // Generated on: 2025-04-24T21:53:42.004Z 2 + // Generated on: 2025-04-24T22:10:45.033Z 3 3 // Year-specific DST data for 2025 4 4 5 5 #include <stdint.h> 6 6 7 - // Total airport codes: 245 8 - static const char airport_code_pool[] = 9 - "PPG" "IUE" "FTI" "HNL" "KOA" "LIH" "ITO" "MKK" 10 - "JHM" "LNY" "ADK" "NHV" "AUQ" "UAP" "GMR" "ANC" 11 - "LAX" "SFO" "LAS" "SEA" "YVR" "SAN" "PDX" "OAK" 12 - "SJC" "SMF" "PHX" "DEN" "SLC" "YYC" "YEG" "ABQ" 13 - "ELP" "MEX" "ORD" "DFW" "IAH" "MSP" "MDW" "DAL" 14 - "STL" "BNA" "AUS" "IPC" "CUN" "HAV" "ATL" "JFK" 15 - "YYZ" "CLT" "MCO" "MIA" "EWR" "BOS" "DTW" "FLL" 16 - "MUN" "CGB" "MAO" "SXM" "CGR" "PVH" "BVB" "YHZ" 17 - "SCL" "YYT" "YDF" "YAY" "YWM" "GRU" "CGH" "BSB" 18 - "GIG" "AEP" "EZE" "CNF" "VCP" "SDU" "POA" "FSP" 19 - "FEN" "GOH" "SID" "PDL" "TER" "DKR" "LHR" "LGW" 20 - "DUB" "MAN" "LIS" "STN" "LTN" "EDI" "LPA" "BHX" 21 - "CMN" "CDG" "AMS" "FRA" "MAD" "BCN" "MUC" "FCO" 22 - "ZRH" "CPH" "PMI" "JNB" "CPT" "TLV" "BEY" "KIV" 23 - "ATH" "HEL" "OTP" "KBP" "HER" "SOF" "GZA" "CAI" 24 - "IST" "SVO" "JED" "SAW" "DME" "AYT" "RUH" "VKO" 25 - "LED" "ESB" "THR" "MHD" "IKA" "SYZ" "AWZ" "KIH" 26 - "IFN" "TBZ" "BND" "PGU" "DXB" "AUH" "SHJ" "MRU" 27 - "TBS" "KUF" "RUN" "DWC" "ASF" "BUS" "KBL" "HEA" 28 - "FBD" "SVX" "UFA" "TJM" "SGC" "CEK" "PEE" "NUX" 29 - "REN" "NJC" "SLY" "DEL" "BOM" "BLR" "CCU" "MAA" 30 - "COK" "PNQ" "AMD" "GOI" "JAI" "KTM" "BWA" "BIR" 31 - "TMI" "OMS" "RGN" "MDL" "CGK" "BKK" "DMK" "SGN" 32 - "HAN" "SUB" "HKT" "KNO" "DAD" "CNX" "PEK" "HKG" 33 - "PVG" "CAN" "SIN" "KUL" "CTU" "SZX" "TPE" "KMG" 34 - "HND" "ICN" "NRT" "CJU" "KIX" "GMP" "FUK" "CTS" 35 - "OKA" "PUS" "DRW" "ASP" "AYQ" "ADL" "PLO" "MGB" 36 - "OLP" "BNE" "OOL" "CNS" "VVO" "KHV" "TSV" "SYD" 37 - "MEL" "CBR" "HBA" "LDH" "UUS" "NLK" "NAN" "PKC" 38 - "AKL" "CHC" "WLG" "ZQN" "NSN" "DUD" "NPE" "PMR" 39 - "CHT" "APW" "TBU" "EUA" "CXI" 40 - ; 7 + // Total airport codes: 245 (codes listed for debug) 8 + // Codes: PPG, IUE, FTI, HNL, KOA, LIH, ITO, MKK, JHM, LNY, ADK, NHV, AUQ, UAP, GMR, ANC, LAX, SFO, LAS, SEA, YVR, SAN, PDX, OAK, SJC, SMF, PHX, DEN, SLC, YYC, YEG, ABQ, ELP, MEX, ORD, DFW, IAH, MSP, MDW, DAL, STL, BNA, AUS, IPC, CUN, HAV, ATL, JFK, YYZ, CLT, MCO, MIA, EWR, BOS, DTW, FLL, MUN, CGB, MAO, SXM, CGR, PVH, BVB, YHZ, SCL, YYT, YDF, YAY, YWM, GRU, CGH, BSB, GIG, AEP, EZE, CNF, VCP, SDU, POA, FSP, FEN, GOH, SID, PDL, TER, DKR, LHR, LGW, DUB, MAN, LIS, STN, LTN, EDI, LPA, BHX, CMN, CDG, AMS, FRA, MAD, BCN, MUC, FCO, ZRH, CPH, PMI, JNB, CPT, TLV, BEY, KIV, ATH, HEL, OTP, KBP, HER, SOF, GZA, CAI, IST, SVO, JED, SAW, DME, AYT, RUH, VKO, LED, ESB, THR, MHD, IKA, SYZ, AWZ, KIH, IFN, TBZ, BND, PGU, DXB, AUH, SHJ, MRU, TBS, KUF, RUN, DWC, ASF, BUS, KBL, HEA, FBD, SVX, UFA, TJM, SGC, CEK, PEE, NUX, REN, NJC, SLY, DEL, BOM, BLR, CCU, MAA, COK, PNQ, AMD, GOI, JAI, KTM, BWA, BIR, TMI, OMS, RGN, MDL, CGK, BKK, DMK, SGN, HAN, SUB, HKT, KNO, DAD, CNX, PEK, HKG, PVG, CAN, SIN, KUL, CTU, SZX, TPE, KMG, HND, ICN, NRT, CJU, KIX, GMP, FUK, CTS, OKA, PUS, DRW, ASP, AYQ, ADL, PLO, MGB, OLP, BNE, OOL, CNS, VVO, KHV, TSV, SYD, MEL, CBR, HBA, LDH, UUS, NLK, NAN, PKC, AKL, CHC, WLG, ZQN, NSN, DUD, NPE, PMR, CHT, APW, TBU, EUA, CXI 9 + static const uint16_t airport_code_pool_bits[] = { 10 + 0x3de6, /* PPG */ 11 + 0x2284, /* IUE */ 12 + 0x1668, /* FTI */ 13 + 0x1dab, /* HNL */ 14 + 0x29c0, /* KOA */ 15 + 0x2d07, /* LIH */ 16 + 0x226e, /* ITO */ 17 + 0x314a, /* MKK */ 18 + 0x24ec, /* JHM */ 19 + 0x2db8, /* LNY */ 20 + 0x6a, /* ADK */ 21 + 0x34f5, /* NHV */ 22 + 0x290, /* AUQ */ 23 + 0x500f, /* UAP */ 24 + 0x1991, /* GMR */ 25 + 0x1a2, /* ANC */ 26 + 0x2c17, /* LAX */ 27 + 0x48ae, /* SFO */ 28 + 0x2c12, /* LAS */ 29 + 0x4880, /* SEA */ 30 + 0x62b1, /* YVR */ 31 + 0x480d, /* SAN */ 32 + 0x3c77, /* PDX */ 33 + 0x380a, /* OAK */ 34 + 0x4922, /* SJC */ 35 + 0x4985, /* SMF */ 36 + 0x3cf7, /* PHX */ 37 + 0xc8d, /* DEN */ 38 + 0x4962, /* SLC */ 39 + 0x6302, /* YYC */ 40 + 0x6086, /* YEG */ 41 + 0x30, /* ABQ */ 42 + 0x116f, /* ELP */ 43 + 0x3097, /* MEX */ 44 + 0x3a23, /* ORD */ 45 + 0xcb6, /* DFW */ 46 + 0x2007, /* IAH */ 47 + 0x324f, /* MSP */ 48 + 0x3076, /* MDW */ 49 + 0xc0b, /* DAL */ 50 + 0x4a6b, /* STL */ 51 + 0x5a0, /* BNA */ 52 + 0x292, /* AUS */ 53 + 0x21e2, /* IPC */ 54 + 0xa8d, /* CUN */ 55 + 0x1c15, /* HAV */ 56 + 0x26b, /* ATL */ 57 + 0x24aa, /* JFK */ 58 + 0x6319, /* YYZ */ 59 + 0x973, /* CLT */ 60 + 0x304e, /* MCO */ 61 + 0x3100, /* MIA */ 62 + 0x12d1, /* EWR */ 63 + 0x5d2, /* BOS */ 64 + 0xe76, /* DTW */ 65 + 0x156b, /* FLL */ 66 + 0x328d, /* MUN */ 67 + 0x8c1, /* CGB */ 68 + 0x300e, /* MAO */ 69 + 0x4aec, /* SXM */ 70 + 0x8d1, /* CGR */ 71 + 0x3ea7, /* PVH */ 72 + 0x6a1, /* BVB */ 73 + 0x60f9, /* YHZ */ 74 + 0x484b, /* SCL */ 75 + 0x6313, /* YYT */ 76 + 0x6065, /* YDF */ 77 + 0x6018, /* YAY */ 78 + 0x62cc, /* YWM */ 79 + 0x1a34, /* GRU */ 80 + 0x8c7, /* CGH */ 81 + 0x641, /* BSB */ 82 + 0x1906, /* GIG */ 83 + 0x8f, /* AEP */ 84 + 0x1324, /* EZE */ 85 + 0x9a5, /* CNF */ 86 + 0x544f, /* VCP */ 87 + 0x4874, /* SDU */ 88 + 0x3dc0, /* POA */ 89 + 0x164f, /* FSP */ 90 + 0x148d, /* FEN */ 91 + 0x19c7, /* GOH */ 92 + 0x4903, /* SID */ 93 + 0x3c6b, /* PDL */ 94 + 0x4c91, /* TER */ 95 + 0xd51, /* DKR */ 96 + 0x2cf1, /* LHR */ 97 + 0x2cd6, /* LGW */ 98 + 0xe81, /* DUB */ 99 + 0x300d, /* MAN */ 100 + 0x2d12, /* LIS */ 101 + 0x4a6d, /* STN */ 102 + 0x2e6d, /* LTN */ 103 + 0x1068, /* EDI */ 104 + 0x2de0, /* LPA */ 105 + 0x4f7, /* BHX */ 106 + 0x98d, /* CMN */ 107 + 0x866, /* CDG */ 108 + 0x192, /* AMS */ 109 + 0x1620, /* FRA */ 110 + 0x3003, /* MAD */ 111 + 0x44d, /* BCN */ 112 + 0x3282, /* MUC */ 113 + 0x144e, /* FCO */ 114 + 0x6627, /* ZRH */ 115 + 0x9e7, /* CPH */ 116 + 0x3d88, /* PMI */ 117 + 0x25a1, /* JNB */ 118 + 0x9f3, /* CPT */ 119 + 0x4d75, /* TLV */ 120 + 0x498, /* BEY */ 121 + 0x2915, /* KIV */ 122 + 0x267, /* ATH */ 123 + 0x1c8b, /* HEL */ 124 + 0x3a6f, /* OTP */ 125 + 0x282f, /* KBP */ 126 + 0x1c91, /* HER */ 127 + 0x49c5, /* SOF */ 128 + 0x1b20, /* GZA */ 129 + 0x808, /* CAI */ 130 + 0x2253, /* IST */ 131 + 0x4aae, /* SVO */ 132 + 0x2483, /* JED */ 133 + 0x4816, /* SAW */ 134 + 0xd84, /* DME */ 135 + 0x313, /* AYT */ 136 + 0x4687, /* RUH */ 137 + 0x554e, /* VKO */ 138 + 0x2c83, /* LED */ 139 + 0x1241, /* ESB */ 140 + 0x4cf1, /* THR */ 141 + 0x30e3, /* MHD */ 142 + 0x2140, /* IKA */ 143 + 0x4b19, /* SYZ */ 144 + 0x2d9, /* AWZ */ 145 + 0x2907, /* KIH */ 146 + 0x20ad, /* IFN */ 147 + 0x4c39, /* TBZ */ 148 + 0x5a3, /* BND */ 149 + 0x3cd4, /* PGU */ 150 + 0xee1, /* DXB */ 151 + 0x287, /* AUH */ 152 + 0x48e9, /* SHJ */ 153 + 0x3234, /* MRU */ 154 + 0x4c32, /* TBS */ 155 + 0x2a85, /* KUF */ 156 + 0x468d, /* RUN */ 157 + 0xec2, /* DWC */ 158 + 0x245, /* ASF */ 159 + 0x692, /* BUS */ 160 + 0x282b, /* KBL */ 161 + 0x1c80, /* HEA */ 162 + 0x1423, /* FBD */ 163 + 0x4ab7, /* SVX */ 164 + 0x50a0, /* UFA */ 165 + 0x4d2c, /* TJM */ 166 + 0x48c2, /* SGC */ 167 + 0x88a, /* CEK */ 168 + 0x3c84, /* PEE */ 169 + 0x3697, /* NUX */ 170 + 0x448d, /* REN */ 171 + 0x3522, /* NJC */ 172 + 0x4978, /* SLY */ 173 + 0xc8b, /* DEL */ 174 + 0x5cc, /* BOM */ 175 + 0x571, /* BLR */ 176 + 0x854, /* CCU */ 177 + 0x3000, /* MAA */ 178 + 0x9ca, /* COK */ 179 + 0x3db0, /* PNQ */ 180 + 0x183, /* AMD */ 181 + 0x19c8, /* GOI */ 182 + 0x2408, /* JAI */ 183 + 0x2a6c, /* KTM */ 184 + 0x6c0, /* BWA */ 185 + 0x511, /* BIR */ 186 + 0x4d88, /* TMI */ 187 + 0x3992, /* OMS */ 188 + 0x44cd, /* RGN */ 189 + 0x306b, /* MDL */ 190 + 0x8ca, /* CGK */ 191 + 0x54a, /* BKK */ 192 + 0xd8a, /* DMK */ 193 + 0x48cd, /* SGN */ 194 + 0x1c0d, /* HAN */ 195 + 0x4a81, /* SUB */ 196 + 0x1d53, /* HKT */ 197 + 0x29ae, /* KNO */ 198 + 0xc03, /* DAD */ 199 + 0x9b7, /* CNX */ 200 + 0x3c8a, /* PEK */ 201 + 0x1d46, /* HKG */ 202 + 0x3ea6, /* PVG */ 203 + 0x80d, /* CAN */ 204 + 0x490d, /* SIN */ 205 + 0x2a8b, /* KUL */ 206 + 0xa74, /* CTU */ 207 + 0x4b37, /* SZX */ 208 + 0x4de4, /* TPE */ 209 + 0x2986, /* KMG */ 210 + 0x1da3, /* HND */ 211 + 0x204d, /* ICN */ 212 + 0x3633, /* NRT */ 213 + 0x934, /* CJU */ 214 + 0x2917, /* KIX */ 215 + 0x198f, /* GMP */ 216 + 0x168a, /* FUK */ 217 + 0xa72, /* CTS */ 218 + 0x3940, /* OKA */ 219 + 0x3e92, /* PUS */ 220 + 0xe36, /* DRW */ 221 + 0x24f, /* ASP */ 222 + 0x310, /* AYQ */ 223 + 0x6b, /* ADL */ 224 + 0x3d6e, /* PLO */ 225 + 0x30c1, /* MGB */ 226 + 0x396f, /* OLP */ 227 + 0x5a4, /* BNE */ 228 + 0x39cb, /* OOL */ 229 + 0x9b2, /* CNS */ 230 + 0x56ae, /* VVO */ 231 + 0x28f5, /* KHV */ 232 + 0x4e55, /* TSV */ 233 + 0x4b03, /* SYD */ 234 + 0x308b, /* MEL */ 235 + 0x831, /* CBR */ 236 + 0x1c20, /* HBA */ 237 + 0x2c67, /* LDH */ 238 + 0x5292, /* UUS */ 239 + 0x356a, /* NLK */ 240 + 0x340d, /* NAN */ 241 + 0x3d42, /* PKC */ 242 + 0x14b, /* AKL */ 243 + 0x8e2, /* CHC */ 244 + 0x5966, /* WLG */ 245 + 0x660d, /* ZQN */ 246 + 0x364d, /* NSN */ 247 + 0xe83, /* DUD */ 248 + 0x35e4, /* NPE */ 249 + 0x3d91, /* PMR */ 250 + 0x8f3, /* CHT */ 251 + 0x1f6, /* APW */ 252 + 0x4c34, /* TBU */ 253 + 0x1280, /* EUA */ 254 + 0xae8, /* CXI */ 255 + }; 256 + 257 + #define AIRPORT_CODE_POOL_BITS_COUNT 245 41 258 42 259 // Total airport names: 245 43 260 static const char airport_name_pool[] = ··· 110 327 ; 111 328 112 329 typedef struct { 113 - float std_offset_hours; 114 - float dst_offset_hours; 115 - int64_t dst_start_utc; 116 - int64_t dst_end_utc; 117 - int name_offset; // Index into airport_code_pool & airport_name_pool 118 - int name_count; // Number of unique airports for this tz variant 330 + int8_t std_quarters; // std offset in 0.25h units 331 + int8_t dst_quarters; // dst offset in 0.25h units 332 + int32_t dst_start_utc; // DST start (seconds since epoch) 333 + int32_t dst_end_utc; // DST end (seconds since epoch) 334 + uint16_t name_offset; // Index into airport_name_pool 335 + uint8_t name_count; // Number of codes in this bucket 119 336 } TzInfo; 120 337 121 338 // Total timezone variants: 60 122 339 static const TzInfo airport_tz_list[] = { 123 - { -11.00f, -11.00f, 0LL, 0LL, 0, 3 }, // Pacific/Pago_Pago, Pacific/Midway, Pacific/Niue... 124 - { -10.00f, -10.00f, 0LL, 0LL, 3, 7 }, // Pacific/Rarotonga, Pacific/Honolulu, Pacific/Tahiti... 125 - { -10.00f, -9.00f, 1741521600LL, 1762081200LL, 10, 1 }, // America/Adak... 126 - { -9.50f, -9.50f, 0LL, 0LL, 11, 3 }, // Pacific/Marquesas... 127 - { -9.00f, -9.00f, 0LL, 0LL, 14, 1 }, // Pacific/Gambier... 128 - { -9.00f, -8.00f, 1741518000LL, 1762077600LL, 15, 1 }, // America/Anchorage... 129 - { -8.00f, -7.00f, 1741514400LL, 1762074000LL, 16, 10 }, // America/Vancouver, America/Tijuana, America/Los_Angeles... 130 - { -7.00f, -7.00f, 0LL, 0LL, 26, 1 }, // America/Dawson_Creek, America/Mazatlan, America/Hermosillo... 131 - { -7.00f, -6.00f, 1741510800LL, 1762070400LL, 27, 6 }, // America/Edmonton, America/Denver, America/Inuvik... 132 - { -6.00f, -6.00f, 0LL, 0LL, 33, 1 }, // America/Regina, America/Guatemala, America/Tegucigalpa... 133 - { -6.00f, -5.00f, 1741507200LL, 1762066800LL, 34, 9 }, // America/Winnipeg, America/Chicago... 134 - { -6.00f, -5.00f, 1757217600LL, 1743908400LL, 43, 1 }, // Pacific/Easter... 135 - { -5.00f, -5.00f, 0LL, 0LL, 44, 1 }, // America/Coral_Harbour, America/Jamaica, America/Cancun... 136 - { -5.00f, -4.00f, 1741496400LL, 1762059600LL, 45, 1 }, // America/Havana... 137 - { -5.00f, -4.00f, 1741503600LL, 1762063200LL, 46, 10 }, // America/Toronto, America/Grand_Turk, America/Port-au-Prince... 138 - { -4.00f, -4.00f, 0LL, 0LL, 56, 7 }, // America/Santo_Domingo, America/Campo_Grande, America/Boa_Vista... 139 - { -4.00f, -3.00f, 1741500000LL, 1762059600LL, 63, 1 }, // America/Thule, America/Halifax, Atlantic/Bermuda... 140 - { -4.00f, -3.00f, 1757217600LL, 1743908400LL, 64, 1 }, // America/Santiago... 141 - { -3.50f, -2.50f, 1741496400LL, 1762056000LL, 65, 4 }, // America/St_Johns... 142 - { -3.00f, -3.00f, 0LL, 0LL, 69, 10 }, // Atlantic/Stanley, America/Cordoba, America/Buenos_Aires... 143 - { -3.00f, -2.00f, 1741496400LL, 1762056000LL, 79, 1 }, // America/Miquelon... 144 - { -2.00f, -2.00f, 0LL, 0LL, 80, 1 }, // America/Noronha... 145 - { -2.00f, -1.00f, 1743296400LL, 1761440400LL, 81, 1 }, // America/Godthab, America/Scoresbysund... 146 - { -1.00f, -1.00f, 0LL, 0LL, 82, 1 }, // Atlantic/Cape_Verde... 147 - { -1.00f, 0.00f, 1743296400LL, 1761440400LL, 83, 2 }, // Atlantic/Azores... 148 - { 0.00f, 0.00f, 0LL, 0LL, 85, 1 }, // Atlantic/Reykjavik, Africa/Ouagadougou, Africa/Accra... 149 - { 0.00f, 1.00f, 1743296400LL, 1761440400LL, 86, 10 }, // Europe/London, Europe/Guernsey, Europe/Jersey... 150 - { 1.00f, 1.00f, 0LL, 0LL, 96, 1 }, // Africa/Algiers, Africa/Porto-Novo, Africa/Lagos... 151 - { 1.00f, 2.00f, 1743296400LL, 1761440400LL, 97, 10 }, // Europe/Brussels, Europe/Berlin, Europe/Amsterdam... 152 - { 2.00f, 2.00f, 0LL, 0LL, 107, 2 }, // Africa/Johannesburg, Africa/Gaborone, Africa/Mbabane... 153 - { 2.00f, 3.00f, 1743120000LL, 1761433200LL, 109, 1 }, // Asia/Jerusalem... 154 - { 2.00f, 3.00f, 1743285600LL, 1761426000LL, 110, 1 }, // Asia/Beirut... 155 - { 2.00f, 3.00f, 1743292800LL, 1761436800LL, 111, 1 }, // Europe/Chisinau... 156 - { 2.00f, 3.00f, 1743296400LL, 1761440400LL, 112, 6 }, // Europe/Tallinn, Europe/Helsinki, Europe/Mariehamn... 157 - { 2.00f, 3.00f, 1744416000LL, 1761346800LL, 118, 1 }, // Asia/Gaza... 158 - { 2.00f, 3.00f, 1745532000LL, 1761858000LL, 119, 1 }, // Africa/Cairo... 159 - { 3.00f, 3.00f, 0LL, 0LL, 120, 10 }, // Indian/Comoro, Indian/Mayotte, Indian/Antananarivo... 160 - { 3.50f, 3.50f, 0LL, 0LL, 130, 10 }, // Asia/Tehran... 161 - { 4.00f, 4.00f, 0LL, 0LL, 140, 10 }, // Indian/Mauritius, Indian/Reunion, Indian/Mahe... 162 - { 4.50f, 4.50f, 0LL, 0LL, 150, 3 }, // Asia/Kabul... 163 - { 5.00f, 5.00f, 0LL, 0LL, 153, 10 }, // Asia/Karachi, Asia/Qyzylorda, Asia/Oral... 164 - { 5.50f, 5.50f, 0LL, 0LL, 163, 10 }, // Asia/Calcutta, Asia/Colombo, Asia/Kolkata... 165 - { 5.75f, 5.75f, 0LL, 0LL, 173, 4 }, // Asia/Katmandu... 166 - { 6.00f, 6.00f, 0LL, 0LL, 177, 1 }, // Asia/Bishkek, Asia/Omsk, Asia/Dhaka... 167 - { 6.50f, 6.50f, 0LL, 0LL, 178, 2 }, // Asia/Rangoon, Indian/Cocos... 168 - { 7.00f, 7.00f, 0LL, 0LL, 180, 10 }, // Asia/Krasnoyarsk, Asia/Phnom_Penh, Asia/Vientiane... 169 - { 8.00f, 8.00f, 0LL, 0LL, 190, 10 }, // Asia/Taipei, Asia/Manila, Asia/Irkutsk... 170 - { 9.00f, 9.00f, 0LL, 0LL, 200, 10 }, // Pacific/Palau, Asia/Tokyo, Asia/Seoul... 171 - { 9.50f, 9.50f, 0LL, 0LL, 210, 3 }, // Australia/Darwin... 172 - { 9.50f, 10.50f, 1759593600LL, 1743872400LL, 213, 4 }, // Australia/Adelaide... 173 - { 10.00f, 10.00f, 0LL, 0LL, 217, 6 }, // Pacific/Port_Moresby, Pacific/Saipan, Pacific/Guam... 174 - { 10.00f, 11.00f, 1759593600LL, 1743868800LL, 223, 4 }, // Australia/Hobart, Australia/Sydney, Australia/Melbourne... 175 - { 10.50f, 11.00f, 1759593600LL, 1743865200LL, 227, 1 }, // Australia/Lord_Howe... 176 - { 11.00f, 11.00f, 0LL, 0LL, 228, 1 }, // Pacific/Efate, Pacific/Noumea, Pacific/Ponape... 177 - { 11.00f, 12.00f, 1759590000LL, 1743865200LL, 229, 1 }, // Pacific/Norfolk... 178 - { 12.00f, 12.00f, 0LL, 0LL, 230, 2 }, // Pacific/Fiji, Pacific/Tarawa, Pacific/Wallis... 179 - { 12.00f, 13.00f, 1758981600LL, 1743861600LL, 232, 8 }, // Pacific/Auckland... 180 - { 12.75f, 13.75f, 1758981600LL, 1743861600LL, 240, 1 }, // Pacific/Chatham... 181 - { 13.00f, 13.00f, 0LL, 0LL, 241, 3 }, // Pacific/Tongatapu, Pacific/Apia, Pacific/Enderbury... 182 - { 14.00f, 14.00f, 0LL, 0LL, 244, 1 }, // Pacific/Kiritimati... 340 + { -44, -44, 0, 0, 0, 3 }, // Pacific/Pago_Pago, Pacific/Midway, Pacific/Niue (-11.00h/-11.00h) 341 + { -40, -40, 0, 0, 3, 7 }, // Pacific/Rarotonga, Pacific/Honolulu, Pacific/Tahiti (-10.00h/-10.00h) 342 + { -40, -36, 1741521600, 1762081200, 10, 1 }, // America/Adak (-10.00h/-9.00h) 343 + { -38, -38, 0, 0, 11, 3 }, // Pacific/Marquesas (-9.50h/-9.50h) 344 + { -36, -36, 0, 0, 14, 1 }, // Pacific/Gambier (-9.00h/-9.00h) 345 + { -36, -32, 1741518000, 1762077600, 15, 1 }, // America/Anchorage (-9.00h/-8.00h) 346 + { -32, -28, 1741514400, 1762074000, 16, 10 }, // America/Vancouver, America/Tijuana, America/Los_Angeles (-8.00h/-7.00h) 347 + { -28, -28, 0, 0, 26, 1 }, // America/Dawson_Creek, America/Mazatlan, America/Hermosillo (-7.00h/-7.00h) 348 + { -28, -24, 1741510800, 1762070400, 27, 6 }, // America/Edmonton, America/Denver, America/Inuvik (-7.00h/-6.00h) 349 + { -24, -24, 0, 0, 33, 1 }, // America/Regina, America/Guatemala, America/Tegucigalpa (-6.00h/-6.00h) 350 + { -24, -20, 1741507200, 1762066800, 34, 9 }, // America/Winnipeg, America/Chicago (-6.00h/-5.00h) 351 + { -24, -20, 1757217600, 1743908400, 43, 1 }, // Pacific/Easter (-6.00h/-5.00h) 352 + { -20, -20, 0, 0, 44, 1 }, // America/Coral_Harbour, America/Jamaica, America/Cancun (-5.00h/-5.00h) 353 + { -20, -16, 1741496400, 1762059600, 45, 1 }, // America/Havana (-5.00h/-4.00h) 354 + { -20, -16, 1741503600, 1762063200, 46, 10 }, // America/Toronto, America/Grand_Turk, America/Port-au-Prince (-5.00h/-4.00h) 355 + { -16, -16, 0, 0, 56, 7 }, // America/Santo_Domingo, America/Campo_Grande, America/Boa_Vista (-4.00h/-4.00h) 356 + { -16, -12, 1741500000, 1762059600, 63, 1 }, // America/Thule, America/Halifax, Atlantic/Bermuda (-4.00h/-3.00h) 357 + { -16, -12, 1757217600, 1743908400, 64, 1 }, // America/Santiago (-4.00h/-3.00h) 358 + { -14, -10, 1741496400, 1762056000, 65, 4 }, // America/St_Johns (-3.50h/-2.50h) 359 + { -12, -12, 0, 0, 69, 10 }, // Atlantic/Stanley, America/Cordoba, America/Buenos_Aires (-3.00h/-3.00h) 360 + { -12, -8, 1741496400, 1762056000, 79, 1 }, // America/Miquelon (-3.00h/-2.00h) 361 + { -8, -8, 0, 0, 80, 1 }, // America/Noronha (-2.00h/-2.00h) 362 + { -8, -4, 1743296400, 1761440400, 81, 1 }, // America/Godthab, America/Scoresbysund (-2.00h/-1.00h) 363 + { -4, -4, 0, 0, 82, 1 }, // Atlantic/Cape_Verde (-1.00h/-1.00h) 364 + { -4, 0, 1743296400, 1761440400, 83, 2 }, // Atlantic/Azores (-1.00h/0.00h) 365 + { 0, 0, 0, 0, 85, 1 }, // Atlantic/Reykjavik, Africa/Ouagadougou, Africa/Accra (0.00h/0.00h) 366 + { 0, 4, 1743296400, 1761440400, 86, 10 }, // Europe/London, Europe/Guernsey, Europe/Jersey (0.00h/1.00h) 367 + { 4, 4, 0, 0, 96, 1 }, // Africa/Algiers, Africa/Porto-Novo, Africa/Lagos (1.00h/1.00h) 368 + { 4, 8, 1743296400, 1761440400, 97, 10 }, // Europe/Brussels, Europe/Berlin, Europe/Amsterdam (1.00h/2.00h) 369 + { 8, 8, 0, 0, 107, 2 }, // Africa/Johannesburg, Africa/Gaborone, Africa/Mbabane (2.00h/2.00h) 370 + { 8, 12, 1743120000, 1761433200, 109, 1 }, // Asia/Jerusalem (2.00h/3.00h) 371 + { 8, 12, 1743285600, 1761426000, 110, 1 }, // Asia/Beirut (2.00h/3.00h) 372 + { 8, 12, 1743292800, 1761436800, 111, 1 }, // Europe/Chisinau (2.00h/3.00h) 373 + { 8, 12, 1743296400, 1761440400, 112, 6 }, // Europe/Tallinn, Europe/Helsinki, Europe/Mariehamn (2.00h/3.00h) 374 + { 8, 12, 1744416000, 1761346800, 118, 1 }, // Asia/Gaza (2.00h/3.00h) 375 + { 8, 12, 1745532000, 1761858000, 119, 1 }, // Africa/Cairo (2.00h/3.00h) 376 + { 12, 12, 0, 0, 120, 10 }, // Indian/Comoro, Indian/Mayotte, Indian/Antananarivo (3.00h/3.00h) 377 + { 14, 14, 0, 0, 130, 10 }, // Asia/Tehran (3.50h/3.50h) 378 + { 16, 16, 0, 0, 140, 10 }, // Indian/Mauritius, Indian/Reunion, Indian/Mahe (4.00h/4.00h) 379 + { 18, 18, 0, 0, 150, 3 }, // Asia/Kabul (4.50h/4.50h) 380 + { 20, 20, 0, 0, 153, 10 }, // Asia/Karachi, Asia/Qyzylorda, Asia/Oral (5.00h/5.00h) 381 + { 22, 22, 0, 0, 163, 10 }, // Asia/Calcutta, Asia/Colombo, Asia/Kolkata (5.50h/5.50h) 382 + { 23, 23, 0, 0, 173, 4 }, // Asia/Katmandu (5.75h/5.75h) 383 + { 24, 24, 0, 0, 177, 1 }, // Asia/Bishkek, Asia/Omsk, Asia/Dhaka (6.00h/6.00h) 384 + { 26, 26, 0, 0, 178, 2 }, // Asia/Rangoon, Indian/Cocos (6.50h/6.50h) 385 + { 28, 28, 0, 0, 180, 10 }, // Asia/Krasnoyarsk, Asia/Phnom_Penh, Asia/Vientiane (7.00h/7.00h) 386 + { 32, 32, 0, 0, 190, 10 }, // Asia/Taipei, Asia/Manila, Asia/Irkutsk (8.00h/8.00h) 387 + { 36, 36, 0, 0, 200, 10 }, // Pacific/Palau, Asia/Tokyo, Asia/Seoul (9.00h/9.00h) 388 + { 38, 38, 0, 0, 210, 3 }, // Australia/Darwin (9.50h/9.50h) 389 + { 38, 42, 1759593600, 1743872400, 213, 4 }, // Australia/Adelaide (9.50h/10.50h) 390 + { 40, 40, 0, 0, 217, 6 }, // Pacific/Port_Moresby, Pacific/Saipan, Pacific/Guam (10.00h/10.00h) 391 + { 40, 44, 1759593600, 1743868800, 223, 4 }, // Australia/Hobart, Australia/Sydney, Australia/Melbourne (10.00h/11.00h) 392 + { 42, 44, 1759593600, 1743865200, 227, 1 }, // Australia/Lord_Howe (10.50h/11.00h) 393 + { 44, 44, 0, 0, 228, 1 }, // Pacific/Efate, Pacific/Noumea, Pacific/Ponape (11.00h/11.00h) 394 + { 44, 48, 1759590000, 1743865200, 229, 1 }, // Pacific/Norfolk (11.00h/12.00h) 395 + { 48, 48, 0, 0, 230, 2 }, // Pacific/Fiji, Pacific/Tarawa, Pacific/Wallis (12.00h/12.00h) 396 + { 48, 52, 1758981600, 1743861600, 232, 8 }, // Pacific/Auckland (12.00h/13.00h) 397 + { 51, 55, 1758981600, 1743861600, 240, 1 }, // Pacific/Chatham (12.75h/13.75h) 398 + { 52, 52, 0, 0, 241, 3 }, // Pacific/Tongatapu, Pacific/Apia, Pacific/Enderbury (13.00h/13.00h) 399 + { 56, 56, 0, 0, 244, 1 }, // Pacific/Kiritimati (14.00h/14.00h) 183 400 }; 184 401 185 402 #define AIRPORT_TZ_LIST_COUNT (sizeof(airport_tz_list)/sizeof(airport_tz_list[0]))
+13 -6
src/c/clock_closest_airport_noon.h
··· 47 47 #define NAME_POOL airport_name_pool 48 48 #define TZ_LIST airport_tz_list 49 49 #define TZ_LIST_COUNT AIRPORT_TZ_LIST_COUNT 50 + // Bit-packed IATA code pool (15-bits per entry) 51 + extern const uint16_t airport_code_pool_bits[]; 50 52 #endif 51 53 52 54 #ifdef __cplusplus ··· 109 111 for (int i = 0; i < (int)TZ_LIST_COUNT; ++i) { 110 112 const TzInfo *tz = &TZ_LIST[i]; 111 113 bool is_dst = _airport_is_dst(tz, (int64_t)current_utc_t); 112 - float offset_h = is_dst ? tz->dst_offset_hours : tz->std_offset_hours; 114 + // reconstruct hours from quarter-hour units 115 + float offset_h = (is_dst ? tz->dst_quarters : tz->std_quarters) * 0.25f; 113 116 long local_secs = (long)utc_secs + (long)(offset_h * 3600.0f); 114 117 local_secs %= DAY_SECONDS; 115 118 if (local_secs < 0) local_secs += DAY_SECONDS; ··· 134 137 int idx = best_candidates[(best_count == 1) ? 0 : (rand() % best_count)]; 135 138 const TzInfo *tz = &TZ_LIST[idx]; 136 139 bool is_dst = _airport_is_dst(tz, (int64_t)current_utc_t); 137 - s_selected_offset_hours = is_dst ? tz->dst_offset_hours : tz->std_offset_hours; 140 + // reconstruct float offset from quarter-hour units 141 + s_selected_offset_hours = (is_dst ? tz->dst_quarters : tz->std_quarters) * 0.25f; 138 142 int cnt = tz->name_count; 139 143 int ni = (cnt == 1) ? 0 : (rand() % cnt); 140 - memcpy((void *)s_selected_code, CODE_POOL + 3 * (tz->name_offset + ni), 3); 141 - s_selected_code[3] = '\0'; // Ensure null termination 142 - int nameIndex = tz->name_offset + ni; 143 - s_selected_name = _airport_flat_name(NAME_POOL, nameIndex); 144 + // unpack 3-letter code from bit-packed 15-bit entries 145 + uint16_t bits = airport_code_pool_bits[tz->name_offset + ni]; 146 + s_selected_code[0] = 'A' + ((bits >> 10) & 0x1F); 147 + s_selected_code[1] = 'A' + ((bits >> 5) & 0x1F); 148 + s_selected_code[2] = 'A' + ( bits & 0x1F); 149 + s_selected_code[3] = '\0'; 150 + s_selected_name = _airport_flat_name(NAME_POOL, tz->name_offset + ni); 144 151 } 145 152 s_last_re_eval_time = current_utc_t; 146 153 }