FIND YOUR NEXT FEW LINES

Results for “time”

Small, practical examples. Search by task or narrow things down below.

236 snippets foundClear filters
PowerShellFunctions & parameter validation

Accept one typed value at a time from a pipeline

PowerShell: An advanced function uses process to handle each pipeline item.

PowerShell✓ Tested
Arduino / CDigital input & output

Blink the built-in LED three times

Alternate the built-in LED with a short blocking delay.

blink✓ Tested
Linux CommandsDates & process utilities

Bound a command execution time

Linux Commands: Use timeout and handle status 124 as an expected time limit.

Linux Commands✓ Tested
Arduino / CTiming & control

Compare elapsed time across timer rollover

Use unsigned subtraction when a millisecond counter wraps.

rollover✓ Tested
Bash ScriptsArguments & decisions

Consume positional arguments one at a time

Bash Scripts: Check the argument count before accessing the first parameter with nounset enabled.

Bash Scripts✓ Tested
C#Dates & precise numbers

Convert a timestamp to a different fixed offset

C#: ToOffset changes the displayed local time while retaining the same instant.

C#✓ Tested
PythonDates & time zones

Convert a Unix timestamp to aware UTC

Python: Supply timezone.utc so the result does not depend on the machine time zone.

Python✓ Tested
Linux CommandsDates & process utilities

Convert a Unix timestamp to UTC

Linux Commands: Use the @ syntax with GNU date for seconds since the Unix epoch.

Linux Commands✓ Tested
PythonDates & time zones

Convert an aware datetime to another offset

Python: Use astimezone for conversion; replacing tzinfo alone does not convert an instant.

Python✓ Tested
JavaDates & time zones

Convert an instant to a regional timezone

Java: Use ZonedDateTime with a named zone to apply that zone’s offset rules.

Java✓ Tested
PowerShellDates & numeric validation

Convert Unix seconds into an aware UTC timestamp

PowerShell: DateTimeOffset.FromUnixTimeSeconds creates a value with an explicit UTC offset.

PowerShell✓ Tested
C#Dates & precise numbers

Convert Unix seconds to an offset-aware timestamp

C#: DateTimeOffset preserves the UTC offset explicitly.

C#✓ Tested