You are viewing page 3 of 216.

Getting Midnight in the UNIX Epoch from Perl

By Timothy R Butler | Posted at 4:49 PM

Many computer functions dealing with time are calculated in the number of seconds since the UNIX Epoch. I wanted to get midnight tomorrow in those Epoch seconds so that my Bible word Wordle clone Biblicle could say when the next word would be available. I couldn’t easily do the entire calculation on the client side in JavaScript, because when the next word is served varies: if the user is logged in, it is at midnight for the user’s specified time zone on FaithTree (which may or may not match their computer’s time zone), but if the user is not logged in, it will be at midnight Central Time (“US/Chicago”).

The calculation needed to be done on the backend on the server, which is written in Perl. This page had a suggestion how to get the number of seconds so far elapsed in the day, which could easily be modified to instead give me the number of seconds remaining. Problem: I want to calculate on the basis of the local time zone not UTC/GMT. Thankfully, using Perl’s DateTime object, that isn’t difficult:

use DateTime;
my $tomorrow = DateTime->now(time_zone => $timeZone);
my $secs = ((23 - $tomorrow->hour) * 3600) + ((59 - $tomorrow->min) * 60) + (59 - $tomorrow->sec);
$tomorrow->add( seconds => ($secs + 1) );
my $tomorrowStarts = $tomorrow->epoch;

With that little code snippet, $tomorrowStarts will return the first second of tomorrow located to $timeZone and relative to the Epoch.

At the Playoffs (February 7, 2022)

By Timothy R Butler | Posted at 9:28 PM

As we live as Christians, we face struggles and opposition. Shouldn’t life be easier? Should we find a way to make it easier?

Songs for Our Temple (Week 6: Psalms 16-18)

By Timothy R Butler | Posted at 7:34 PM

I turn to Psalms 16-18 that point us to the lasting treasure of God’s love on tonight’s “This Week at Little Hills.”

Not Enough Green Squares (January 31, 2022)

By Timothy R Butler | Posted at 8:59 PM

Sometimes the deck appears to stacked and it’s hard to see how life will do anything but go from bad to worse. How do we have joy then?

Songs for Our Temple (Week 5: Psalms 13-15)

By Timothy R Butler | Posted at 11:01 PM

Join us as the Psalminizers come together for a discussion about the problems of life and the solution in Psalms 13-15.

Sorry, Sold Out (January 24, 2022)

By Timothy R Butler | Posted at 8:21 PM

As we think about joy in dark places, Paul turns to those who are actually preaching the Gospel with the aim of discrediting him. What do we do when people and circumstances seem to want to hurt us?

The Zippy Christmas Extravaganza

By Timothy R Butler | Posted at 5:43 PM

I meant to post this link ahead of Christmas, but it is still the 12 Days of Christmas, so…

The Zippy Crew takes you over the river and through the woods with a review of a fantastic new Nat “King” Cole Christmas album, sharing of Christmas memories and reflections on the upcoming 12 Days of Christmas. Also, Special Guest Jim Krenning joins us for a preview of an adventure through the Psalms in the New Year.

This episode was so much fun. I hope you enjoy it!

Return to Sender (December 27, 2021)

By Timothy R Butler | Posted at 9:15 PM

So Christmas is over, right? Not so fast! Traditionally the Church celebrated the joy of Jesus’s birth in the days after Christmas and after a hard couple of years, there are some very good reasons from God’s Word to pick that tradition up.

Because of Christmas

By Timothy R Butler | Posted at 1:21 PM

Merry Christmas! I love the 12 Days of Christmas as those who follow this blog know well. And, as has become my tradition, I have a new little devotional booklet to share with you in case you’d like to observe those wonderful days between Christmas and Epiphany with me:

During Advent, we all excitedly look towards celebrating Jesus’s birth. However, suddenly it is December 26 and the world resets to its ordinary preoccupations. That’s what is wonderful about observing the Twelve Days of Christmas: it helps us keep reflecting on God’s grace and the miracle of Christmas after the busyness of Christmas Day is past. Tim Butler has prepared a free devotional booklet for these next twelve days.

You can download Because of Christmas for free to begin this year’s devotional journey. There’s a companion Facebook Event where you can leave comments and I’ll be posting some additional reflections.

You can also purchase print or Kindle copies at Amazon (Affiliate Link) if you’d like. I mostly put it on Amazon to reach people who don’t know me and thus might stumble across it there while looking for something to celebrate Christmas with, but the link is there if you want it in those formats.

Christmas Eve at Little Hills (December 24, 2020)

By Timothy R Butler | Posted at 7:00 PM

Join us as Little Hills celebrates Christmas Eve! During the service we will share in the culmination of our journey through the Spirit’s Work at Christmas that we have been exploring over Advent. Jim Krenning, Joyce Neikirk and I will share from God’s Word and Melanie Haynes will lead us in a Christmas carol to celebrate that our Savior is born!

You are viewing page 3 of 216.