Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ares_compat.c File Reference

#include "ares_private.h"
#include <rtl_time.h>

Include dependency graph for ares_compat.c:

Go to the source code of this file.

Functions

int gettimeofday (struct timeval *tv, struct timezone *tz)
int strcasecmp (const char *s1, const char *s2)
char * strdup (const char *s)
time_t time (time_t *tp)


Function Documentation

int gettimeofday struct timeval tv,
struct timezone *  tz
 

Definition at line 58 of file gettimeofday.c.

00058                                                          {
00059   struct timespec now;
00060   clock_gettime(CLOCK_MONOTONIC, &now);
00061   tv->tv_sec = (long) now.tv_sec;
00062   tv->tv_usec = now.tv_nsec / 1000;
00063   return 0;
00064 } 

int strcasecmp const char *  s1,
const char *  s2
 

Definition at line 17 of file ares_compat.c.

00018 {
00019   register const unsigned char *p1 = (const unsigned char *) s1;
00020   register const unsigned char *p2 = (const unsigned char *) s2;
00021   unsigned char c1, c2;
00022 
00023   if (p1 == p2)
00024     return 0;
00025 
00026 
00027 
00028 
00029   do
00030     {
00031       c1 = tolower (*p1++);
00032       c2 = tolower (*p2++);
00033       if (c1 == '\0')
00034         break;
00035     }
00036   while (c1 == c2);
00037 
00038   return c1 - c2;
00039 }

char* strdup const char *  s  ) 
 

Definition at line 41 of file ares_compat.c.

References malloc, and NULL.

00042 {
00043         char *ns;
00044 
00045         if(!s)
00046             return NULL;
00047 
00048         ns = malloc(strlen(s)+1);
00049         if(ns)
00050                 strcpy(ns, s);
00051 
00052         return ns;
00053 }

time_t time time_t *  tp  ) 
 

Definition at line 56 of file ares_compat.c.

References gettimeofday(), NULL, and time.

00057 {
00058 
00059   struct timeval time;
00060 
00061 //      long ticks = RetrieveClock();
00062 //      long secs;
00063 
00064 //      secs = (ticks * 4 + ticks * 8 / 13) / 1000;
00065 
00066 
00067   gettimeofday(&time, NULL);
00068 
00069   if(tp)
00070     *tp = (long) time.tv_sec;
00071 
00072 
00073 
00074         return (time_t) time.tv_sec;
00075 }

Here is the call graph for this function:


Generated on Wed Jan 14 12:58:59 2004 for RTL-lwIP-0.4 by doxygen 1.3.4