hsftp-1.4.0: A SFTP client tool for secure file transfer operations
Copyright(c) IOcrafts 2024-present
LicenseBSD
MaintainerMaurizio Dusi
Stabilitystable
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Util

Description

This module provides utility functions for file, date and time manipulation.

Synopsis

Documentation

createFile :: FilePath -> IO () Source #

Create a file if it does not exist.

Example usage:

>>> createFile "test.txt"

toDate :: String -> UTCTime Source #

Convert a string to seconds since Epoch. The input string should be in the format %F %R %Z (YYYY-MM-DD HH-mm and abbreviated time zone name). If the parsing fails, it defaults to the beginning of Epoch (i.e., zero).

Example usage:

>>> toDate "2022-01-01 12:00 UTC"
2022-01-01 12:00:00 UTC

toEpoch :: UTCTime -> Integer Source #

Convert a UTCTime value to seconds since Epoch.

Example usage:

>>> toEpoch (UTCTime (fromGregorian 2022 01 01) (secondsToDiffTime 0))
  1640995200