return ret;
}
+
+/**
+ * Convert a given fancy human-readable time to our internal
+ * representation.
+ *
+ * @param fancy_time human readable string (i.e. %Y-%m-%d %H:%M:%S)
+ * @param atime set to the absolute time
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int
+GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time,
+ struct GNUNET_TIME_Absolute *atime)
+{
+ struct tm tv;
+ time_t t;
+
+ if ( (NULL == strptime (fancy_time, "%c", &tv)) &&
+ (NULL == strptime (fancy_time, "%Ec", &tv)) &&
+ (NULL == strptime (fancy_time, "%Y-%m-%d %H:%M:%S", &tv)) &&
+ (NULL == strptime (fancy_time, "%Y-%m-%d %H:%M", &tv)) &&
+ (NULL == strptime (fancy_time, "%x", &tv)) &&
+ (NULL == strptime (fancy_time, "%Ex", &tv)) &&
+ (NULL == strptime (fancy_time, "%Y-%m-%d", &tv)) &&
+ (NULL == strptime (fancy_time, "%Y-%m", &tv)) &&
+ (NULL == strptime (fancy_time, "%Y", &tv)) )
+ return GNUNET_SYSERR;
+ t = mktime (&tv);
+ atime->abs_value = (uint64_t) ((uint64_t) t * 1000LL);
+ return GNUNET_OK;
+}
+
+
/**
* Convert the len characters long character sequence
* given in input that is in the given input charset
return GNUNET_STRINGS_conv (input, len, charset, "UTF-8");
}
+
/**
* Convert the len bytes-long UTF-8 string
* given in input to the given charset.
-
+ *
* @return the converted string (0-terminated),
* if conversion fails, a copy of the orignal
* string is returned.
return GNUNET_STRINGS_conv (input, len, "UTF-8", charset);
}
+
/**
* Convert the utf-8 input string to lowercase
* Output needs to be allocated appropriately
free(tmp_in);
}
+
/**
* Convert the utf-8 input string to uppercase
* Output needs to be allocated appropriately
GNUNET_STRINGS_filename_expand (const char *fil)
{
char *buffer;
-
#ifndef MINGW
size_t len;
size_t n;
}
-
/**
* Tries to convert 'zt_addr' string to an IPv6 address.
* The string is expected to have the format "[ABCD::01]:80".
return GNUNET_STRINGS_to_address_ipv4 (addr, addrlen, (struct sockaddr_in *) r_buf);
}
+
/**
* Makes a copy of argv that consists of a single memory chunk that can be
* freed with a single call to GNUNET_free ();
return (char *const *) new_argv;
}
+
/**
* Returns utf-8 encoded arguments.
* Does nothing (returns a copy of argc and argv) on any platform