MCPcopy Create free account
hub / github.com/eggert/tz / doabbr

Function doabbr

zic.c:3121–3157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3119 return "%z";
3120 } else {
3121 char sign = offset < 0 ? '-' : '+';
3122 int_fast32_t abs_offset = offset < 0 ? -offset : offset;
3123 int seconds = abs_offset % SECSPERMIN;
3124 int abs_minutes_offset = abs_offset / SECSPERMIN;
3125 int minutes = abs_minutes_offset % MINSPERHOUR;
3126 int hours = abs_minutes_offset / MINSPERHOUR;
3127 char *p = buf;
3128 *p++ = sign;
3129 *p++ = '0' + hours / 10;
3130 *p++ = '0' + hours % 10;
3131 if (minutes | seconds) {
3132 *p++ = '0' + minutes / 10;
3133 *p++ = '0' + minutes % 10;
3134 if (seconds) {
3135 *p++ = '0' + seconds / 10;
3136 *p++ = '0' + seconds % 10;
3137 }
3138 }
3139 *p = '\0';
3140 return buf;
3141 }
3142}
3143
3144static char const disable_percent_s[] = "";
3145
3146static ptrdiff_t
3147doabbr(char *abbr, struct zone const *zp, char const *letters,
3148 bool isdst, zic_t save, bool doquotes)
3149{
3150 register char * cp;
3151 ptrdiff_t len;
3152 char const *format = zp->z_format;
3153 char const *slashp = strchr(format, '/');
3154
3155 if (slashp == NULL) {
3156 char letterbuf[PERCENT_Z_LEN_BOUND + 1];
3157 if (zp->z_format_specifier == 'z')
3158 letters = abbroffset(letterbuf, zp->z_stdoff + save);
3159 else if (!letters)
3160 letters = "%s";

Callers 2

stringzoneFunction · 0.85
outzoneFunction · 0.85

Calls 3

abbroffsetFunction · 0.85
mempcpyFunction · 0.85
is_alphaFunction · 0.70

Tested by

no test coverage detected