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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/mkexpert.pike:129:    // This is needed because some implementations of localtime(3C)    // do not support negative timestamps (eg AIX).    int best_score = sizeof(zones);    int best_split = 1;    int best_t = 0;    mapping(int:array(object)) best_histogram = ([]);    for (l = start; l < sizeof(times); l++) {    mapping(int:array(object)) histogram = mkhistogram(zones, times[l]);    int score = max(0, @map(values(histogram), sizeof));    int split = sizeof(histogram); -  if ((score < best_score) || -  ((score == best_score) && (split > best_split))) { +  if ((split > best_split) || +  ((split == best_split) && (score < best_score))) {    best_score = score;    best_split = split;    best_t = times[l];    best_histogram = histogram;    }    }    if (best_split == 1) {    // No suitable date found.    // Retry with dates pre 1970-01-01.    // Prefer more recent dates, as the ancient historic dates may
pike.git/lib/modules/Calendar.pmod/mkexpert.pike:152:    for (l = start; l--;) {    if ((times[l] < -0x80000000) && (best_split != 1) &&    (times[l+1] >= -0x80000000)) {    // Several implementations of localtime(3C) are 32 bit.    // We already have a useable date, so stop the search for now.    break;    }    mapping(int:array(object)) histogram = mkhistogram(zones, times[l]);    int score = max(0, @map(values(histogram), sizeof));    int split = sizeof(histogram); -  if ((score < best_score) || -  ((score == best_score) && (split > best_split))) { +  if ((split > best_split) || +  ((split == best_split) && (score < best_score))) {    best_score = score;    best_split = split;    best_t = times[l];    best_histogram = histogram;    }    }    if (best_split == 1) {    // Still no suitable date found.    return sort(zones->zoneid);    }