1 /* Blue Sky: File Systems in the Cloud
3 * Copyright (C) 2009 The Regents of the University of California
4 * Written by Michael Vrable <mvrable@cs.ucsd.edu>
14 #include "bluesky-private.h"
16 /* Miscellaneous useful functions that don't really fit anywhere else. */
18 bluesky_time_hires bluesky_now_hires()
22 if (clock_gettime(CLOCK_REALTIME, &time) != 0) {
23 perror("clock_gettime");
27 return (int64_t)(time.tv_sec) * 1000000000 + time.tv_nsec;
30 /* Convert a UTF-8 string to lowercase. This can be used to implement
31 * case-insensitive lookups and comparisons, by normalizing all values to
32 * lowercase first. Returns a newly-allocated string as a result. */
33 gchar *bluesky_lowercase(const gchar *s)
35 /* TODO: Unicode handling; for now just do ASCII. */
36 return g_ascii_strdown(s, -1);