Sha256: a6406782aa05b1855ae7b608c4615f25938d1ef64eea0e43ae2505f2efbfac68

Contents?: true

Size: 221 Bytes

Versions: 8

Compression:

Stored size: 221 Bytes

Contents

VALUE uptime_f(VALUE obj) {
	FILE *f = fopen("/proc/uptime", "r") ;
	if (!f) return Qnil ;

	double up_f ;
	char status = fscanf(f, "%lf", &up_f) ;
	fclose(f) ;

	if (status != 1) return Qnil ;

	return DBL2NUM(up_f) ;
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
linux_stat-2.2.3 ext/procfs/uptime.h
linux_stat-2.2.2 ext/procfs/uptime.h
linux_stat-2.2.1 ext/procfs/uptime.h
linux_stat-2.2.0 ext/procfs/uptime.h
linux_stat-2.1.2 ext/procfs/uptime.h
linux_stat-2.1.1 ext/procfs/uptime.h
linux_stat-2.1.0 ext/procfs/uptime.h
linux_stat-2.0.1 ext/procfs/uptime.h