diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,7 @@
+#### 0.2.0.0 *2024-11-29*
+
+	* Add support for CGroup and time namespaces.
+
 #### 0.1.3.1 *2023-06-23*
 
 	* Support building with `unix-2.8`.
diff --git a/System/Linux/Namespaces.hsc b/System/Linux/Namespaces.hsc
--- a/System/Linux/Namespaces.hsc
+++ b/System/Linux/Namespaces.hsc
@@ -45,6 +45,10 @@
     , writeUserMappings
     , writeGroupMappings
 
+    -- * Setting offsets for virtualized clocks
+    , Clock(..)
+    , setClockOffset
+
     -- * Example
     -- $example
     ) where
@@ -54,7 +58,7 @@
 
 import Foreign
 import Foreign.C
-import System.Posix.Types (Fd(..), ProcessID, UserID, GroupID)
+import System.Posix.Types (Fd(..), ProcessID, UserID, GroupID, EpochTime)
 import System.Posix.IO
 import System.Posix.Files (readSymbolicLink)
 import Control.Exception (bracket)
@@ -70,7 +74,7 @@
 --------------------------------------------------------------------------------
 
 -- | Types of namespaces.
-data Namespace = IPC | Network | Mount | PID | User | UTS
+data Namespace = IPC | Network | Mount | PID | User | UTS | CGroup | Time
   deriving (Show, Read, Eq, Bounded, Enum)
 
 toCloneFlags :: Namespace -> CInt
@@ -82,6 +86,8 @@
         PID     -> (#const CLONE_NEWPID)
         User    -> (#const CLONE_NEWUSER)
         UTS     -> (#const CLONE_NEWUTS)
+        CGroup  -> (#const CLONE_NEWCGROUP)
+        Time    -> (#const CLONE_NEWTIME)
 
 toProcName :: Namespace -> String
 toProcName ns =
@@ -92,6 +98,8 @@
         PID     -> "pid"
         User    -> "user"
         UTS     -> "uts"
+        CGroup  -> "cgroup"
+        Time    -> "time"
 
 -- | Detach the process from one or more namespaces and move it to new
 -- ones. See the man page of @unshare(2)@ for more details.
@@ -130,7 +138,11 @@
         setNamespace fd (Just ns)
   where
     openFd' = ioeSetLoc "enterNamespace" $
+#if MIN_VERSION_unix(2,8,0)
         openFd path ReadOnly defaultFileFlags {nonBlock = True}
+#else
+        openFd path ReadOnly Nothing defaultFileFlags {nonBlock = True}
+#endif
     path = toProcPath (Just pid) ns
 
 -- | A unique namespace id.
@@ -213,9 +225,39 @@
 
 --------------------------------------------------------------------------------
 
+-- | The virtualized clock whose offset is set
+-- @time_namespaces(7)@ for more details.
+data Clock = Monotonic | Boottime
+  deriving (Show, Read, Eq)
+
+-- | Set the offset for a virtualized clock. This can only be called before any
+-- process has been created in the time namespace. This function requires
+-- @\/proc@ to be mounted. See @time_namespaces(7)@ for more details.
+setClockOffset
+    :: Clock           -- ^ Specify the clock whose offset is set.
+    -> EpochTime       -- ^ The seconds component of the offset. This value
+                       -- can be negative.
+    -> CLong           -- ^ The nanoseconds component of the offset. This
+                       -- value must not be negative.
+    -> IO ()
+setClockOffset clock offsetSecs offsetNanosecs =
+    ioeSetLoc "setClockOffset" $ do
+        writeProcFile "/proc/self/timens_offsets" (C.pack s)
+  where
+    s = concat [clockId, " ", show offsetSecs, " ", show offsetNanosecs]
+    clockId = case clock of
+        Monotonic -> "monotonic"
+        Boottime -> "boottime"
+
+--------------------------------------------------------------------------------
+
 writeProcFile :: FilePath -> ByteString -> IO ()
 writeProcFile path bs =
+#if MIN_VERSION_unix(2,8,0)
     bracket (openFd path WriteOnly defaultFileFlags) closeFd $ \fd ->
+#else
+    bracket (openFd path WriteOnly Nothing defaultFileFlags) closeFd $ \fd ->
+#endif
         S.useAsCStringLen bs $ \(ptr, nb) ->
             fdWriteBuf fd (castPtr ptr) (fromIntegral nb) >> return ()
 
diff --git a/linux-namespaces.cabal b/linux-namespaces.cabal
--- a/linux-namespaces.cabal
+++ b/linux-namespaces.cabal
@@ -1,5 +1,5 @@
 name:                linux-namespaces
-version:             0.1.3.1
+version:             0.2.0.0
 synopsis:            Work with linux namespaces: create new or enter existing ones
 description:
   This library provides bindings to the @unshare(2)@ and @setns(2)@ linux
@@ -23,7 +23,7 @@
 
 library
   exposed-modules:     System.Linux.Namespaces
-  build-depends:       base >=4.6 && <5, unix >=2.8 && <3.0, bytestring >=0.10 && <1.0
+  build-depends:       base >=4.6 && <5, unix >=2.6 && <3.0, bytestring >=0.10 && <1.0
   build-tools:         hsc2hs
   default-language:    Haskell2010
   ghc-options:         -Wall
