1- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
1+ #[ cfg_attr(
2+ any( target_env = "musl" , target_env = "ohos" ) ,
3+ allow( deprecated)
4+ ) ]
25// https://github.com/rust-lang/libc/issues/1848
36pub use libc:: { suseconds_t, time_t} ;
47use libc:: { timespec, timeval} ;
@@ -253,7 +256,10 @@ impl PartialOrd for TimeSpec {
253256
254257impl TimeValLike for TimeSpec {
255258 #[ inline]
256- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
259+ #[ cfg_attr(
260+ any( target_env = "musl" , target_env = "ohos" ) ,
261+ allow( deprecated)
262+ ) ]
257263 // https://github.com/rust-lang/libc/issues/1848
258264 fn seconds ( seconds : i64 ) -> TimeSpec {
259265 assert ! (
@@ -286,7 +292,10 @@ impl TimeValLike for TimeSpec {
286292
287293 /// Makes a new `TimeSpec` with given number of nanoseconds.
288294 #[ inline]
289- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
295+ #[ cfg_attr(
296+ any( target_env = "musl" , target_env = "ohos" ) ,
297+ allow( deprecated)
298+ ) ]
290299 // https://github.com/rust-lang/libc/issues/1848
291300 fn nanoseconds ( nanoseconds : i64 ) -> TimeSpec {
292301 let ( secs, nanos) = div_mod_floor_64 ( nanoseconds, NANOS_PER_SEC ) ;
@@ -340,7 +349,10 @@ impl TimeSpec {
340349 TimeSpec :: new ( 0 , libc:: UTIME_NOW as timespec_tv_nsec_t ) ;
341350
342351 /// Construct a new `TimeSpec` from its components
343- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ] // https://github.com/rust-lang/libc/issues/1848
352+ #[ cfg_attr(
353+ any( target_env = "musl" , target_env = "ohos" ) ,
354+ allow( deprecated)
355+ ) ] // https://github.com/rust-lang/libc/issues/1848
344356 pub const fn new ( seconds : time_t , nanoseconds : timespec_tv_nsec_t ) -> Self {
345357 let mut ts = zero_init_timespec ( ) ;
346358 ts. tv_sec = seconds;
@@ -356,7 +368,10 @@ impl TimeSpec {
356368 }
357369 }
358370
359- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ] // https://github.com/rust-lang/libc/issues/1848
371+ #[ cfg_attr(
372+ any( target_env = "musl" , target_env = "ohos" ) ,
373+ allow( deprecated)
374+ ) ] // https://github.com/rust-lang/libc/issues/1848
360375 pub const fn tv_sec ( & self ) -> time_t {
361376 self . 0 . tv_sec
362377 }
@@ -365,7 +380,10 @@ impl TimeSpec {
365380 self . 0 . tv_nsec
366381 }
367382
368- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
383+ #[ cfg_attr(
384+ any( target_env = "musl" , target_env = "ohos" ) ,
385+ allow( deprecated)
386+ ) ]
369387 // https://github.com/rust-lang/libc/issues/1848
370388 pub const fn from_duration ( duration : Duration ) -> Self {
371389 let mut ts = zero_init_timespec ( ) ;
@@ -506,7 +524,10 @@ impl TimeValLike for TimeVal {
506524 ( TV_MIN_SECONDS ..=TV_MAX_SECONDS ) . contains( & seconds) ,
507525 "TimeVal out of bounds; seconds={seconds}"
508526 ) ;
509- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
527+ #[ cfg_attr(
528+ any( target_env = "musl" , target_env = "ohos" ) ,
529+ allow( deprecated)
530+ ) ]
510531 // https://github.com/rust-lang/libc/issues/1848
511532 TimeVal ( timeval {
512533 tv_sec : seconds as time_t ,
@@ -531,7 +552,10 @@ impl TimeValLike for TimeVal {
531552 ( TV_MIN_SECONDS ..=TV_MAX_SECONDS ) . contains( & secs) ,
532553 "TimeVal out of bounds"
533554 ) ;
534- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
555+ #[ cfg_attr(
556+ any( target_env = "musl" , target_env = "ohos" ) ,
557+ allow( deprecated)
558+ ) ]
535559 // https://github.com/rust-lang/libc/issues/1848
536560 TimeVal ( timeval {
537561 tv_sec : secs as time_t ,
@@ -549,7 +573,10 @@ impl TimeValLike for TimeVal {
549573 ( TV_MIN_SECONDS ..=TV_MAX_SECONDS ) . contains( & secs) ,
550574 "TimeVal out of bounds"
551575 ) ;
552- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
576+ #[ cfg_attr(
577+ any( target_env = "musl" , target_env = "ohos" ) ,
578+ allow( deprecated)
579+ ) ]
553580 // https://github.com/rust-lang/libc/issues/1848
554581 TimeVal ( timeval {
555582 tv_sec : secs as time_t ,
@@ -586,7 +613,10 @@ impl TimeValLike for TimeVal {
586613
587614impl TimeVal {
588615 /// Construct a new `TimeVal` from its components
589- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ] // https://github.com/rust-lang/libc/issues/1848
616+ #[ cfg_attr(
617+ any( target_env = "musl" , target_env = "ohos" ) ,
618+ allow( deprecated)
619+ ) ] // https://github.com/rust-lang/libc/issues/1848
590620 pub const fn new ( seconds : time_t , microseconds : suseconds_t ) -> Self {
591621 Self ( timeval {
592622 tv_sec : seconds,
@@ -602,7 +632,10 @@ impl TimeVal {
602632 }
603633 }
604634
605- #[ cfg_attr( target_env = "musl" , allow( deprecated) ) ] // https://github.com/rust-lang/libc/issues/1848
635+ #[ cfg_attr(
636+ any( target_env = "musl" , target_env = "ohos" ) ,
637+ allow( deprecated)
638+ ) ] // https://github.com/rust-lang/libc/issues/1848
606639 pub const fn tv_sec ( & self ) -> time_t {
607640 self . 0 . tv_sec
608641 }
0 commit comments