Skip to content

pfun.clock.Clock dataclass

Module providing clock capabilities.

now(self, tz=None)

Create an Effect that succeeds with the current datetime

Parameters:

Name Type Description Default
tz tzinfo

timezone info

None

Returns:

Type Description
pfun.effect.Effect[object, NoReturn, datetime.datetime]

Effect that succeeds with the current datetime

sleep(self, seconds)

Create an Effect that Suspends execution for seconds.

Parameters:

Name Type Description Default
seconds float

interval to suspend execution

required

Returns:

Type Description
pfun.effect.Effect[object, NoReturn, NoneType]

Effect that suspends execution for seconds

pfun.clock.HasClock

Module provider for the clock capability.

Attributes:

Name Type Description
clock Clock

The clock module

pfun.clock.sleep(seconds)

Create an Effect that Suspends execution for seconds.

Examples:

>>> from pfun import DefaultModules
>>> sleep(2).run(DefaultModules)

Parameters:

Name Type Description Default
seconds float

interval to suspend execution

required

Returns:

Type Description
pfun.effect.Effect[pfun.clock.HasClock, NoReturn, NoneType]

Effect that suspends execution for seconds

pfun.clock.now(tz=None)

Create an Effect that succeeds with the current datetime

Examples:

>>> from pfun import DefaultModules
>>> now().run(DefaultModules)

Parameters:

Name Type Description Default
tz tzinfo

timezone info

None

Returns:

Type Description
pfun.effect.Effect[pfun.clock.HasClock, NoReturn, datetime.datetime]

Effect that succeeds with the current datetime