Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit28e4ba7

Browse files
committed
uptime: make it compile on Android & Redox
1 parenta0b6e8d commit28e4ba7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/uucore/src/lib/features/uptime.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn get_formatted_time() -> String {
4949
/// # Returns
5050
///
5151
/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
52-
#[cfg(target_os ="openbsd")]
52+
#[cfg(all(target_os ="openbsd", target_os ="redox", target_os ="android"))]
5353
pubfnget_uptime(_boot_time:Option<time_t>) ->UResult<i64>{
5454
use libc::CLOCK_BOOTTIME;
5555
use libc::clock_gettime;
@@ -88,7 +88,7 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
8888
///
8989
/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
9090
#[cfg(unix)]
91-
#[cfg(not(target_os ="openbsd"))]
91+
#[cfg(not(any(target_os ="openbsd", target_os ="redox", target_os ="android")))]
9292
pubfnget_uptime(boot_time:Option<time_t>) ->UResult<i64>{
9393
usecrate::utmpx::Utmpx;
9494
use libc::BOOT_TIME;
@@ -187,7 +187,7 @@ pub fn get_formatted_uptime(boot_time: Option<time_t>) -> UResult<String> {
187187
///
188188
/// Returns the number of users currently logged in if successful, otherwise 0.
189189
#[cfg(unix)]
190-
#[cfg(not(target_os ="openbsd"))]
190+
#[cfg(not(any(target_os ="openbsd", target_os ="redox", target_os ="android")))]
191191
// see: https://gitlab.com/procps-ng/procps/-/blob/4740a0efa79cade867cfc7b32955fe0f75bf5173/library/uptime.c#L63-L115
192192
pubfnget_nusers() ->usize{
193193
usecrate::utmpx::Utmpx;
@@ -202,6 +202,12 @@ pub fn get_nusers() -> usize {
202202
num_user
203203
}
204204

205+
#[cfg(all(target_os ="redox", target_os ="android"))]
206+
pubfnget_nusers() ->usize{
207+
// TODO implement
208+
0
209+
}
210+
205211
/// Get the number of users currently logged in
206212
///
207213
/// # Returns

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp