@@ -49,7 +49,7 @@ pub fn get_formatted_time() -> String {
49
49
/// # Returns
50
50
///
51
51
/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
52
- #[ cfg( target_os ="openbsd" ) ]
52
+ #[ cfg( any ( target_os ="openbsd" , target_os = "android" , target_os = "redox" ) ) ]
53
53
pub fn get_uptime ( _boot_time : Option < time_t > ) ->UResult < i64 > {
54
54
use libc:: CLOCK_BOOTTIME ;
55
55
use libc:: clock_gettime;
@@ -88,7 +88,7 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
88
88
///
89
89
/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
90
90
#[ cfg( unix) ]
91
- #[ cfg( not( target_os ="openbsd" ) ) ]
91
+ #[ cfg( not( any ( target_os ="openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
92
92
pub fn get_uptime ( boot_time : Option < time_t > ) ->UResult < i64 > {
93
93
use crate :: utmpx:: Utmpx ;
94
94
use libc:: BOOT_TIME ;
@@ -187,7 +187,7 @@ pub fn get_formatted_uptime(boot_time: Option<time_t>) -> UResult<String> {
187
187
///
188
188
/// Returns the number of users currently logged in if successful, otherwise 0.
189
189
#[ cfg( unix) ]
190
- #[ cfg( not( target_os ="openbsd" ) ) ]
190
+ #[ cfg( not( any ( target_os ="openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
191
191
// see: https://gitlab.com/procps-ng/procps/-/blob/4740a0efa79cade867cfc7b32955fe0f75bf5173/library/uptime.c#L63-L115
192
192
pub fn get_nusers ( ) ->usize {
193
193
use crate :: utmpx:: Utmpx ;
@@ -234,6 +234,12 @@ pub fn get_nusers(file: &str) -> usize {
234
234
nusers
235
235
}
236
236
237
+ // TODO implement functionality
238
+ #[ cfg( any( target_os ="android" , target_os ="redox" ) ) ]
239
+ pub fn get_nusers ( ) ->usize {
240
+ 0
241
+ }
242
+
237
243
/// Get the number of users currently logged in
238
244
///
239
245
/// # Returns
@@ -333,6 +339,7 @@ pub fn get_formatted_nusers() -> String {
333
339
/// Returns a UResult with the load average if successful, otherwise an UptimeError.
334
340
/// The load average is a tuple of three floating point numbers representing the 1-minute, 5-minute, and 15-minute load averages.
335
341
#[ cfg( unix) ]
342
+ #[ cfg( not( any( target_os ="android" , target_os ="redox" ) ) ) ]
336
343
pub fn get_loadavg ( ) ->UResult < ( f64 , f64 , f64 ) > {
337
344
use crate :: libc:: c_double;
338
345
use libc:: getloadavg;
@@ -348,6 +355,12 @@ pub fn get_loadavg() -> UResult<(f64, f64, f64)> {
348
355
}
349
356
}
350
357
358
+ // TODO implement functionality
359
+ #[ cfg( any( target_os ="android" , target_os ="redox" ) ) ]
360
+ pub fn get_loadavg ( ) ->UResult < ( f64 , f64 , f64 ) > {
361
+ Err ( UptimeError :: SystemLoadavg ) ?
362
+ }
363
+
351
364
/// Get the system load average
352
365
/// Windows does not have an equivalent to the load average on Unix-like systems.
353
366
///