8
8
use chrono:: { Local , TimeZone , Utc } ;
9
9
use clap:: ArgMatches ;
10
10
use std:: ffi:: OsString ;
11
+ #[ cfg( not( windows) ) ]
11
12
use std:: fs;
12
13
use std:: io;
14
+ #[ cfg( unix) ]
13
15
use std:: os:: unix:: fs:: FileTypeExt ;
14
16
use thiserror:: Error ;
15
17
use uucore:: error:: set_exit_code;
@@ -27,7 +29,7 @@ use uucore::{format_usage, help_about, help_usage};
27
29
28
30
#[ cfg( target_os ="openbsd" ) ]
29
31
use utmp_classic:: { parse_from_path, UtmpEntry } ;
30
- #[ cfg( not( target_os ="openbsd" ) ) ]
32
+ #[ cfg( not( any ( windows , target_os ="openbsd" ) ) ) ]
31
33
use uucore:: utmpx:: * ;
32
34
33
35
const ABOUT : & str =help_about ! ( "uptime.md" ) ;
@@ -42,7 +44,7 @@ use uucore::libc::getloadavg;
42
44
43
45
#[ cfg( windows) ]
44
46
extern "C" {
45
- fn GetTickCount ( ) ->uucore :: libc :: uint32_t ;
47
+ fn GetTickCount ( ) ->u32 ;
46
48
}
47
49
48
50
#[ derive( Debug , Error ) ]
@@ -203,6 +205,13 @@ fn uptime_with_file(file_path: &OsString) -> UResult<()> {
203
205
Ok ( ( ) )
204
206
}
205
207
208
+ // TODO implement function
209
+ #[ cfg( not( unix) ) ]
210
+ fn uptime_with_file ( _file_path : & OsString ) ->UResult < ( ) > {
211
+ show_error ! ( "not implemented yet" ) ;
212
+ Ok ( ( ) )
213
+ }
214
+
206
215
/// Default uptime behaviour i.e. when no file argument is given.
207
216
fn default_uptime ( matches : & ArgMatches ) ->UResult < ( ) > {
208
217
#[ cfg( target_os ="openbsd" ) ]
@@ -345,7 +354,7 @@ fn print_time() {
345
354
print ! ( " {} " , local_time. format( "%H:%M:%S" ) ) ;
346
355
}
347
356
348
- #[ cfg( not( target_os ="openbsd" ) ) ]
357
+ #[ cfg( not( any ( windows , target_os ="openbsd" ) ) ) ]
349
358
fn get_uptime_from_boot_time ( boot_time : time_t ) ->i64 {
350
359
let now =Local :: now ( ) . timestamp ( ) ;
351
360
#[ cfg( target_pointer_width ="64" ) ]