X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=extras%2Fgudev%2Fgudevdevice.c;h=38d602c42ac2600bafaafa2cb48a0995d39ecee6;hb=eabac232a51b8d8dc2f6897018968bfe96d2912d;hp=4c41849bb1ac3099f1a2f7b6584a4139cd89d2e4;hpb=0976fd063e1e488e388ec922fcd4dbed5b8da938;p=elogind.git diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c index 4c41849bb..38d602c42 100644 --- a/extras/gudev/gudevdevice.c +++ b/extras/gudev/gudevdevice.c @@ -538,7 +538,7 @@ out: * @key: Name of property. * * Look up the value for @key on @device and convert it to an unsigned - * 64-bit integer using strtoll(). + * 64-bit integer using g_ascii_strtoull(). * * Returns: The value for @key or 0 if @key doesn't exist or isn't a * #guint64. @@ -558,7 +558,7 @@ g_udev_device_get_property_as_uint64 (GUdevDevice *device, if (s == NULL) goto out; - result = strtoll (s, NULL, 0); + result = g_ascii_strtoull (s, NULL, 0); out: return result; } @@ -756,7 +756,7 @@ out: * @name: Name of the sysfs attribute. * * Look up the sysfs attribute with @name on @device and convert it to an unsigned - * 64-bit integer using strtoll(). + * 64-bit integer using g_ascii_strtoull(). * * Returns: The value of the sysfs attribute or 0 if there is no such * attribute. @@ -776,7 +776,7 @@ g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, if (s == NULL) goto out; - result = strtoll (s, NULL, 0); + result = g_ascii_strtoull (s, NULL, 0); out: return result; } @@ -925,3 +925,40 @@ g_udev_device_get_tags (GUdevDevice *device) return (const gchar * const *) device->priv->tags; } +/** + * g_udev_device_get_is_initialized: + * @device: A #GUdevDevice. + * + * Gets whether @device has been initalized. + * + * Returns: Whether @device has been initialized. + * + * Since: 165 + */ +gboolean +g_udev_device_get_is_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + return udev_device_get_is_initialized (device->priv->udevice); +} + +/** + * g_udev_device_get_usec_since_initialized: + * @device: A #GUdevDevice. + * + * Gets number of micro-seconds since @device was initialized. + * + * This only works for devices with properties in the udev + * database. All other devices return 0. + * + * Returns: Number of micro-seconds since @device was initialized or 0 if unknown. + * + * Since: 165 + */ +guint64 +g_udev_device_get_usec_since_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_usec_since_initialized (device->priv->udevice); +} +