pike.git / lib / modules / Calendar.pmod / Timezone.pmod

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Timezone.pmod:94: Inside #if 1
   }), string fname) {    // Mapping from file name to variable name.    string var_name =    ([ "/etc/timezone":"",    "/etc/TIMEZONE":"TZ",    "/etc/sysconfig/clock":"ZONE",    "/etc/conf.d/clock":"TIMEZONE",    "/etc/localtime":0,    ])[fname];    catch { + #if constant(readlink) +  if (!var_name && Stdio.is_link(fname)) { +  s = readlink(fname); +  if (s) { +  array(string) a = s/"/"; +  // Modern zones usually have two levels. +  // (Eg Europe/Paris) +  tz = Calendar.Timezone[a[<1..]*"/"] || +  // NB: There are some zones that have three levels. +  // (Eg America/Indiana/Indianapolis) +  Calendar.Timezone[a[<2..]*"/"] || +  // Old-style zones have a single level. +  Calendar.Timezone[a[-1]]; +  if (tz) return tz; +  } +  } + #endif    if (Stdio.is_file(fname) && (s = Stdio.read_bytes(fname))) {    if (!var_name) {    if (tz = tz_from_tzfile(s)) return tz;    } else {    foreach(s/"\n", string line) {    line = (line/"#")[0]; // Strip comments.    if (sscanf(line, "%*s" + var_name + "=%s", s) == 2) {    sscanf(s, "\"%s\"", s); // Strip quotes (if any).    if (tz = `[](s))    {