Logo Search packages:      
Sourcecode: libical version File versions

int icaltimezone_dump_changes ( icaltimezone *  zone,
int  max_year,
FILE *  fp 
)

This outputs a list of timezone changes for the given timezone to the given file, up to the maximum year given. We compare this output with the output from 'vzic --dump-changes' to make sure that we are consistent. (vzic is the Olson timezone database to VTIMEZONE converter.)

The output format is:

Zone-Name [tab] Date [tab] Time [tab] UTC-Offset

The Date and Time fields specify the time change in UTC.

The UTC Offset is for local (wall-clock) time. It is the amount of time to add to UTC to get local time.

Definition at line 1853 of file icaltimezone.c.

References format_utc_offset().

{
    static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
    icaltimezonechange *zone_change;
    int change_num;
    char buffer[8];

    /* Make sure the changes array is expanded up to the given time. */
    icaltimezone_ensure_coverage (zone, max_year);

#if 0
    printf ("Num changes: %i\n", zone->changes->num_elements);
#endif

    change_num = 0;
    for (change_num = 0; (unsigned int)change_num < zone->changes->num_elements; change_num++) {
      zone_change = icalarray_element_at (zone->changes, change_num);

      if (zone_change->year > max_year)
          break;

      fprintf (fp, "%s\t%2i %s %04i\t%2i:%02i:%02i",
            zone->location,
            zone_change->day, months[zone_change->month - 1],
            zone_change->year,
            zone_change->hour, zone_change->minute, zone_change->second);

      /* Wall Clock Time offset from UTC. */
      format_utc_offset (zone_change->utc_offset, buffer);
      fprintf (fp, "\t%s", buffer);

      fprintf (fp, "\n");
    }
      return 1;
}


Generated by  Doxygen 1.6.0   Back to index