tweaks
This commit is contained in:
parent
199ffa6c36
commit
bca68c263d
1 changed files with 9 additions and 9 deletions
18
Touch.hsc
18
Touch.hsc
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
module Touch (
|
module Touch (
|
||||||
TimeSpec(..),
|
TimeSpec(..),
|
||||||
now,
|
nowTime,
|
||||||
omit,
|
omitTime,
|
||||||
touchBoth,
|
touchBoth,
|
||||||
touch
|
touch
|
||||||
) where
|
) where
|
||||||
|
@ -28,8 +28,8 @@ instance Storable TimeSpec where
|
||||||
-- use the larger alignment of the two types in the struct
|
-- use the larger alignment of the two types in the struct
|
||||||
alignment _ = max sec_alignment nsec_alignment
|
alignment _ = max sec_alignment nsec_alignment
|
||||||
where
|
where
|
||||||
sec_alignment = alignment $ undefined::CTime
|
sec_alignment = alignment (undefined::CTime)
|
||||||
nsec_alignment = alignment $ undefined::CLong
|
nsec_alignment = alignment (undefined::CLong)
|
||||||
sizeOf _ = #{size struct timespec}
|
sizeOf _ = #{size struct timespec}
|
||||||
peek ptr = do
|
peek ptr = do
|
||||||
sec <- #{peek struct timespec, tv_sec} ptr
|
sec <- #{peek struct timespec, tv_sec} ptr
|
||||||
|
@ -40,10 +40,10 @@ instance Storable TimeSpec where
|
||||||
#{poke struct timespec, tv_nsec} ptr nsec
|
#{poke struct timespec, tv_nsec} ptr nsec
|
||||||
|
|
||||||
{- special timespecs -}
|
{- special timespecs -}
|
||||||
omit :: TimeSpec
|
omitTime :: TimeSpec
|
||||||
omit = TimeSpec 0 #const UTIME_OMIT
|
omitTime = TimeSpec 0 #const UTIME_OMIT
|
||||||
now :: TimeSpec
|
nowTime :: TimeSpec
|
||||||
now = TimeSpec 0 #const UTIME_NOW
|
nowTime = TimeSpec 0 #const UTIME_NOW
|
||||||
|
|
||||||
{- While its interface is beastly, utimensat is in recent
|
{- While its interface is beastly, utimensat is in recent
|
||||||
POSIX standards, unlike futimes. -}
|
POSIX standards, unlike futimes. -}
|
||||||
|
@ -68,4 +68,4 @@ touchBoth file atime mtime follow =
|
||||||
else at_symlink_nofollow
|
else at_symlink_nofollow
|
||||||
|
|
||||||
touch :: FilePath -> TimeSpec -> Bool -> IO Bool
|
touch :: FilePath -> TimeSpec -> Bool -> IO Bool
|
||||||
touch file mtime follow = touchBoth file omit mtime follow
|
touch file mtime follow = touchBoth file omitTime mtime follow
|
||||||
|
|
Loading…
Reference in a new issue