-void* gras_malloc (long int bytes) {
- void *ptr = (bytes == 0 ? NULL : (void*) malloc ((size_t) bytes));
- gras_assert1(ptr, "Malloc of %ld bytes failed",bytes);
- return ptr;
-}
-void* gras_malloc0 (long int bytes) {
- void *ptr = (bytes == 0 ? NULL : (void*) calloc ((size_t) bytes, 1));
- gras_assert1(ptr, "Malloc of %ld bytes failed",bytes);
- return ptr;
-}
-
-void* gras_realloc (void *memory, long int bytes) {
- if (bytes == 0) {
- gras_free(memory);
- return NULL;
- } else {
- void *ptr = (void*) realloc (memory, (size_t) bytes);
- gras_assert1(ptr, "Realloc of %ld bytes failed",bytes);
- return ptr;
- }
-}
-char* gras_strdup (const char* str) {
- char *ret = (char*)strdup(str);
- gras_assert0(ret, "String duplication failed");
- return ret;
+ return (double)(tv.tv_sec + tv.tv_usec / 1000000.0);
+#else
+ /* Poor resolution */
+ return (double)(time(NULL));
+#endif /* HAVE_GETTIMEOFDAY? */