Changeset d7312ac for src/libcfa/time.c


Ignore:
Timestamp:
May 5, 2018, 9:33:28 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
7867eb9
Parents:
43c461d
Message:

make directives work and use them to remove warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/time.c

    r43c461d rd7312ac  
    1010// Created On       : Tue Mar 27 13:33:14 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 12 14:41:00 2018
    13 // Update Count     : 22
     12// Last Modified On : Sat May  5 09:04:51 2018
     13// Update Count     : 36
    1414//
    1515
     
    1717#include "iostream"
    1818#include <stdio.h>                                                                              // snprintf
     19#include <assert.h>
    1920
    2021static char * nanomsd( long int ns, char * buf ) {              // most significant digits
     
    8788        time_t s = tv / TIMEGRAN;
    8889        tm tm;
    89         gmtime_r( &s, &tm );
     90        gmtime_r( &s, &tm );                                                            // tm_mon <= 11, tm_mday <= 31
     91#pragma GCC diagnostic push
     92#pragma GCC diagnostic ignored "-Wformat-truncation"
    9093        snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_year % 99, tm.tm_mon + 1, tm.tm_mday );
     94#pragma GCC diagnostic pop
    9195        return buf;
    9296} // yy_mm_dd
     
    9599        time_t s = tv / TIMEGRAN;
    96100        tm tm;
    97         gmtime_r( &s, &tm );
     101        gmtime_r( &s, &tm );                                                            // tm_mon <= 11, tm_mday <= 31
     102#pragma GCC diagnostic push
     103#pragma GCC diagnostic ignored "-Wformat-truncation"
    98104        snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mon + 1, tm.tm_mday, tm.tm_year % 99 );
     105#pragma GCC diagnostic pop
    99106        return buf;
    100107} // mm_dd_yy
     
    103110        time_t s = tv / TIMEGRAN;
    104111        tm tm;
    105         gmtime_r( &s, &tm );
     112        gmtime_r( &s, &tm );                                                            // tm_mon <= 11, tm_mday <= 31
     113#pragma GCC diagnostic push
     114#pragma GCC diagnostic ignored "-Wformat-truncation"
    106115        snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year % 99 );
     116#pragma GCC diagnostic pop
    107117        return buf;
    108118} // dd_mm_yy
Note: See TracChangeset for help on using the changeset viewer.