Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/acorn/riscos.c  view on Meta::CPAN


#ifdef gmtime
#  undef gmtime
#endif

/* Acorn's implementation of localtime() and gmtime()
 * doesn't consider the timezone offset, so we have to
 * add it before calling the library functions
 */

struct tm *riscos_localtime(const time_t *timer)
{
 time_t localt=*timer;

 localt+=SWI_Read_Timezone()/100;

 return localtime(&localt);
}

struct tm *riscos_gmtime(const time_t *timer)
{
 time_t localt=*timer;

 localt+=SWI_Read_Timezone()/100;

 return gmtime(&localt);
}

unzip-6.0/acorn/riscos.h  view on Meta::CPAN

void closedir(DIR *d);
int unlink(char *f);
int rmdir(char *d);
int chmod(char *file, int mode);
void setfiletype(char *fname,int ftype);
void getRISCOSexts(char *envstr);
int checkext(char *suff);
void swapext(char *name, char *exptr);
void remove_prefix(void);
void set_prefix(void);
struct tm *riscos_localtime(const time_t *timer);
struct tm *riscos_gmtime(const time_t *timer);

#endif /* !__riscos_h */

unzip-6.0/macos/source/mactime.c  view on Meta::CPAN



/*****************************************************************************/
/*  Prototypes                                                               */
/*****************************************************************************/
/* internal prototypes */
static void clear_tm(struct tm * tm);
static long GMTDelta(void);
static Boolean DaylightSaving(void);
static time_t GetTimeMac(void);
static time_t Mactime(time_t *timer);
static void   normalize(int *i,int *j,int norm);
static struct tm *time2tm(const time_t *timer);
static time_t tm2time(struct tm *tp);

/* Because serial port and SLIP conflict with ReadXPram calls,
   we cache the call here so we don't hang on calling ReadLocation()  */
static void myReadLocation(MachineLocation * loc);


/* prototypes for STD lib replacement functions */
struct tm *my_gmtime(const time_t *t);
struct tm *my_localtime(const time_t *t);

unzip-6.0/macos/source/mactime.c  view on Meta::CPAN

 *  These functions gmtime(), mktime(), localtime() and time()
 *  expects and returns unix times.
 *
 * At midnight Jan. 1, 1970 GMT, the local time was
 *    midnight Jan. 1, 1970 + GMTDelta().
 *
 *
 *****************************************************************************/


struct tm *my_gmtime(const time_t *timer)
{
    return time2tm(timer);
}




struct tm *my_localtime(const time_t *timer)
{
    time_t maclocal;

    maclocal = *timer;
    maclocal += GMTDelta();

    return time2tm(&maclocal);
}




time_t my_mktime(struct tm *tp)
{

unzip-6.0/macos/source/mactime.c  view on Meta::CPAN

  while(*i >= norm)
    {
    *i -= norm;
    (*j)++;
    }
}



/*  Returns the GMT times  */
static time_t Mactime(time_t *timer)
{
    time_t t = GetTimeMac();

    if (timer != NULL)
        *timer = t;

    return t;
}




static struct tm *time2tm(const time_t *timer)
{
    DateTimeRec dtr;
    MachineLocation loc;
    time_t macLocal = *timer;

    static struct tm statictime;
    static const short monthday[12] =
        {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};

    UNIX_TO_MACOS(macLocal);
    SecondsToDate(macLocal, &dtr);

    statictime.tm_sec  = dtr.second;         /* second, from 0 to 59 */
    statictime.tm_min  = dtr.minute;         /* minute, from 0 to 59 */

unzip-6.0/wince/wince.cpp  view on Meta::CPAN

   0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
};

// Month to Leap Year Day conversion array.
int M2LYD[] = {
   0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
};

//******************************************************************************
//-- Called from list.c
struct tm * __cdecl localtime(const time_t *timer) {

   // Return value for localtime().  Source currently never references
   // more than one "tm" at a time, so the single return structure is ok.
   static struct tm g_tm;
   ZeroMemory(&g_tm, sizeof(g_tm));

   // Get our time zone information.
   TIME_ZONE_INFORMATION tzi;
   SafeGetTimeZoneInformation(&tzi);

   // Create a time_t that has been corrected for our time zone.
   time_t localTime = *timer - (tzi.Bias * 60L);

   // Decide if value is in Daylight Savings Time.
   if (g_tm.tm_isdst = (int)IsDST(&tzi, localTime)) {
      localTime -= tzi.DaylightBias * 60L; // usually 60 minutes
   } else {
      localTime -= tzi.StandardBias * 60L; // usually  0 minutes
   }

   // time_t   is a 32-bit value for the seconds since January 1, 1970
   // FILETIME is a 64-bit value for the number of 100-nanosecond intervals



( run in 1.144 second using v1.01-cache-2.11-cpan-49f99fa48dc )