A Little Realignment

LSSThe proverb that nothing is certain but death and taxes is one that I think we’ve all heard and agree with, begrudgingly. Certainly I recall how much I hated filing my taxes when I was a freelancer, not because I resented having to pay income tax but because it just seemed so damn complicated to gather all the numbers in order to fulfill one of my civic duties. That period of my worklife left such a bad taste in my mouth that it took me years to settle my situation (i.e., finally filing retroactively) even though I was only a regular worker with a few simple tax slips.

Now I’m the total opposite of how I used to be. As of December 23, I downloaded the Studio Tax application and prepared my 2017 return because I already know all the numbers to fill in except one or two which will be confirmed when I get all my tax slips. In the meantime, I entered educated guesses for those few unconfirmed numbers based on my last three previous filings, and the one certainty I do have is that the final result won’t be wildly different once I get the accurate figures in late-January or early-February.

Decisions, Decisions!
My thinking has changed a little since the last of my eight-post series last year on how to get out and stay out of debt. In that post, I explained how, once out of debt, I distributed my savings so that I could live well before retirement yet be assured of having a comfortable retirement starting at 60. Then, in the “Counting My Blessings” section of my “disjointed thoughts” post last October, I wrote that “it’s not like I’m deferring toward retirement every dollar I save like a zealot praying to a skybound entity in the hope of gaining entry into a blissful afterlife.”

Sometime after that post, however, I stared at the numbers in my spreadsheets and began wondering two things:

  1. Will I really have enough when I retire?
  2. If I did max out my RRSP contributions, would I be cutting too close to the bone?

So I made copies of my spreadsheets and used them to work out alternate scenarios. If I didn’t like how the numbers played out, I would toss out those copies and not think about it again. But I did like what I saw, I would alter my originals to reflect the new scheme I came up with.

Although the last year at work has been challenging, there’s one thing I can safely count on: I’ll still be there by this time next year. That’s an important point because one principle of my financial strategy has been to ensure not only that I don’t live paycheque to paycheque or month to month but also that I should have access to at least six months’ net salary should the unthinkable (being dismissed from my job) happen. Thus I made a few styling adjustments to one sheet of my workbooks in order to highlight how often and how long I would:

  1. be under that 6-month minimum figure, and
  2. have less than $2,500 unsheltered, easily accessible cash on hand for emergencies and unplanned incidentals.

It turns out that, under my new distribution scheme, the former would only happen twice (from January to mid-July 2018 and from September 2020 to early-May 2021) and the latter would only happen twice as well (from January to late-June 2018 and two of five two-week periods from January to mid-March 2019) — and that’s all based on very conservative income estimations and the continuation of ultra low interest rates. Then, thinking back to the 23 months (November 2011 to October 2013) during which I held the reigns so very tightly in order to get out of debt, I realized that this new scenario is not only bearable but in fact infinitely better than when I was struggling out of debt since the two conditions are at least partially met right through retirement in late-2025.

How lucky I am! I can max out both my RRSP and TFSA by late September 2018 and still live well. There are definitely perks to being single and having a decent job.

Pensions and Savings
The other way in which I’m lucky is that I’m among the last ones at work who has a defined benefits pension, meaning that I already have firm figures on how much I’ll receive from it per year if I retire at 60. It would obviously be a much nicer amount if I stayed until 65, but by now I can’t countenance the thought. The last estimate I could get my hands on dates back to a year ago and is likely slightly better now. Then, one morning this December, the Québec government pension plan sent me a statement showing me how much I would get at 60 or 65 if all remains roughly equal. And, starting at 65, I would get Old Age Security from the federal government, which is currently just under $584 a month and will likely be a bit more by the time I retire since it’s indexed to the Canadian Consumer Price index.

All these amounts are taxable, but even if I add up the raw numbers, I wouldn’t have nearly enough to get through a year at the level to which I’ve become accustomed.

Year Work Québec Canada Total
2026-2029 17,520 6,876 0 24,396
2030 16,150 6,876 2,335 25,361
2031 + 14,232 6,876 7,005 28,204

Remember that unlike a lot of people, I won’t need a pre-retirement period to get used to earning less since I already know exactly how much I need per year to sustain my current (comfortable but not outrageous) lifestyle. That’s where the retirement savings will need to kick in, but I couldn’t help wondering, “How long would they last?”

The Certainty of Taxes
The idea behind an RRSP is that you will have to pay income taxes when withdrawing from it, but given how one would be at a much lower tax bracket by that time (aided as well by extra breaks from age 65 and older), the amount of taxes paid will be much less than it would be now. And while any interest on savings in a non-registered account is also taxed, those in a TFSA never are since contributions to it are made after tax. The best situation, if it can be achieved, would be not to touch the RRSP until forced to convert it to a RRIF at 71 and withdraw a certain percentage every year as shown below.

But the need to convert to a RRIF would be 11 years into my planned retirement date, so could I pull off waiting until 2037 before starting to withdraw from it?

Enter my 2017 tax return, my geekiness, and my almost infinite patience to work out a long and complicated idea.

After carefully studying the forms for several years of tax filing in Studio Tax, I noticed that as much as there are some changes over time — new taxes or breaks, an ever-increasing personal deduction amount, and varying maximum deductions amounts and percentages of allowable deductions — the calculation from year to year is eerily similar and some changes are easily predictable. For example, the annual factor applied to the personal deduction amount is 1.013 federally and 1.0109 provincially.

So, I added a new sheet in one of my two financial workbooks and replicated all the formulas that would summarize exactly my 2017 return in Excel, simplifying it by entering only the lines that I would ever be likely to use and ignoring all the others. Then, since I have worksheets predicting my income for every pay period until my retirement and what will likely be my allowable contribution room in my RRSP, I calculated the likely results of all my filings up to and including 2025, highlighting the cells that will likely require an edit to a different amount or percentage when that time would come. As a result, any change in future calculations — major or minor —
can easily be integrated into that sheet. The only variable that’s up in the air right now is tax on dividends, as I’ve put off joining my employer’s shares savings program to 2018, meaning I don’t yet know the impact of that at tax time.

Still, when that all seemed to work well and make sense, I added the rows that would be applicable when my income would consist of pensions or would become applicable once I reached 65. My goal is to have $42.5K per year of spendable cash plus whatever income tax I would need to pay for the previous fiscal year. As expected, as I started plugging the numbers, since no deduction would be taken at the source from that point, I would have to start paying taxes rather than receiving returns from 2026 onwards. That being said, I got to see with my own eyes the veracity of Québec government officials’ assertion that a sizeable percentage of people here don’t pay any income tax because there’s not only an age-based deduction but one for people who live alone year-round and earn little. (That’s about the only tax break singles get given politicans’ constant emphasis on “middle-class families.”) In fact, it would seem that Québec will only be wanting its pound of flesh from me once I reach 71.

I then entered the percentages in the second table above to my RRSP worksheet and added another sheet to that workbook to replicate the first table above for each year in order to see how much I would need to take from general or TFSA savings and find out if indeed I could hold off to 71 before touching my RRSP/RRIF, and how long would my TFSA and other savings would last. All my predictions on interest earnings were based on today’s historically low rates of return and my legendary low-risk appetite when investing. However, since most experts agree that the currently low interest rates won’t be staying that way for much longer, I’m confident that my estimate on that front is very low-balled, which is consistent with my approach of underestimating income and overestimating expenses.

Just so you know, I didn’t grab that figure of $42.5K/year plus the previous year’s tax bill out of thin air. I have three projected revenue figures in one of my spreadsheets: all sources of income including interest (taxable and non-taxable), take-home pay if I don’t participate in my employer’s share savings program, and take-home pay if I do. I also know from another spreadsheet how much I spend on average each year, which excludes what I sock away in savings, not to mention the percentage of all income I tend to save on a normal year (i.e., 27-30 percent, which I gather is higher than the average Canadian). So that $42.5K figure is based on my projected 2025 take-home pay and is roughly the median between if I were and I weren’t to participate in my employer’s program. In other words, it should be an amount far greater than what I’d be accustomed to spending each year.

How These Calculations Led to a Little Realignment
Many financial planners out there seem to agree that you need to prepare to have 70 percent of your income at the time retirement. Some say it can be a bit less since some of your expenses will disappear upon retirement, like work clothes and transportation, not to mention that your days of setting money aside for retirement will be over. Others try to come up with a more firm number along with a reminder among all of them that you have to plan on living 30 years into retirement.

Frankly, what I was never able to understand in that piece of advice is whether they were saying that you needed 70 percent of your pre-tax or after-tax income. It seemed to me it should be the latter since that’s what you’ve always had to work with (assuming you didn’t foolishly spend your tax return instead of reinvesting it), not to mention you’re supposed to be in a lower tax bracket by then, which is said to be the benefit of having saved into an RRSP. But having spent so much time figuring out exactly how much cash I could have spent actually ended up in savings, I realized, as I just stated, that I’m already shaving off nearly a third of any net income each year that I could have spent elsewhere if I didn’t pay as much attention as I do.

How Much “Paying Attention”
Precisely $76.75 of all my revenues in 2017 (or 0.16%) can’t be traced, but much of that is probably change I used to feed the clothes dryer, and the remainder of that are nickels and dimes that I just throw into a jar. (I have remarkably few nickels and dimes in there.) That goes to show why I’m better not handling actual cash and relying on paying everything electronically or from my debit or credit card which I consistently pay off well before the 21-day grace period on purchases.

 

The other thing financial planners go on about (almost to the point of scaring you) is how inflation will affect your savings. There’s a valid point there, but only to a certain extent. As I explained in my “Get Out of Debt” series last year, taking a yearly approach to your budget provides a lot of absorbency when prices do go up. In fact, that’s the reason why I don’t think my most recent number crunching was a fool’s errand in any way. I know that prices will go up by the time I retire, but I will have gradually adapted to them already and thus they’ll be buffered in. What’s more, when one of the financial institutions I use increased the return on savings by a tiny bit (0.15 percent, to be precise), the positive impact was surprisingly noticeable, just like when the Québec government decreased the tax rate by 1 percent for the first slice of one’s earnings. So even if rates go up only 2 percent by 2025, which I suspect is a conservative estimate, my savings pot by that year will be considerably greater than what I’m now predicting it will be. Plus, if you followed my logic for selecting that $42.5K/year target, that gives me a HUGE buffer for inflation right there.

So in the end, what I found is that, based on my current savings projections, my TFSA would dry up in 2040 (the year I would turn 80) and I would have used nearly $55K more than the amount I invested into it, while my RIFF, from which I would need to start withdrawing a minimum percentage in 2037 (the January 1st I will have turned 71), would dry up by 2055 (the year I would turn 90) and I would have used more than $150K than what I invested into it. Given my bad health habits and the genetic predisposition on both sides of my family, I seriously doubt I’ll reach 90, but this calculation nevertheless demonstates that I could live quite well for 30 years into retirement.

That being said, it’ll be interesting to see what will be the effect of rising interest rates in the coming years. The first three of eight announcements from the Bank of Canada in 2018 will be on January 17, March 7 and April 18, and I expect at least one 0.25 percent increase by April at the latest, and most analysts expect a total increase of at least 0.5 percent by the end of 2018, meaning two increases in that year alone. I plugged in a single 0.15 percent increase as of January 24 and that alone would extend my TFSA by a year, so all the signs are pointing to my having more than enough to retire at 60.

The bottom line is that I’m no longer in the least bit worried about retirement, if everything else stays relatively constant. This little realignment will be a minor short-term adjustment or “sacrifice” that will yield a major long-term gain — not to mention, complete peace of mind.

Yet Another Grab Bag

I suppose wishes for a Happy New Year are in order even though, unbelievably, we’re almost at the mid-point of January already. Indeed, the first two work weeks of 2012 are already done, although the first, for me, was only three days long.

I’ve had a whole whack of blog topics come to mind in the month since my last entry, but somehow I got distracted by other things.

Wondering If It Works
Many months ago, the geek in me found that it was possible to edit what’s known as the .htaccess file for a website to exclude visits from anyone whose IP is from a specific country. For instance, one common practice is to exclude anyone with a Russian IP given how many spammers use that set of IPs. But for my part, in an attempt to feel more free to write what I wanted in aMMusing, I added commands to exclude all IPs from a particular country in North America. You’ve got three guesses (literally!) and the first two don’t count. I’m not certain these commands really work, but like a gift, it’s the thought that counts, I suppose.

Gail Vaz-OxladeA Marvel I Don’t Understand
I told you at great lengths back in October that I did my budget this fall on a massive spreadsheet. It seems to be working well three months into maintaining it, although I can’t understand why. Crazy, eh? I mean, I developed it so I should be able to understand it! Then again, this isn’t the first time I developed something that works without understanding why. Some would say I’ve become totally obsessed with my budget spreadsheet, as I keep working on it and looking at how the numbers are playing out; however, there’s something extremely empowering about it for me since it’s about looking towards the future and figuring out how to build an emergency nestegg (and how fast) and how I’ll pay to replace my car (which I expect to do around Junior’s 10th anniversary in Spring 2013).

My financial hero these days is Canadian best-selling author and host of ‘Til Debt Do U$ Part (with the “Home Edition” aired on HGTV), Gail Vaz-Oxlade. Not only does she make a lot of sense, but her blunt “tough love” bits of advice pass well because of her delightful accent (she was born in Jamaica).

Among Vaz-Oxlade’s bits of advice, there’s the need to create a budget. Some people equate “budget” with “cutting back,” just like others equate “diet” with “losing weight,” but that’s not her point. Instead, it’s the preliminary step to finding out exactly how much money is coming in and how much is going out on what. It has to include not just weekly or monthly spending but quarterly and annual obligations as well, like property taxes, water taxes, haircuts, dentist visits, vehicule registration, and so on. That’s the point where one sees where there’s fat that can be trimmed or cut out entirely.

She gets the people on her show to stop using credit cards and even debit cards and rely only on cash which she places in specifically labelled jars. (Personally I use my debit card as cash and rarely to get cash from an ATM, and I find I spend less that way than having loose cash in my wallet and pocket.) In some more extreme cases, she cuts back participants’ expenses by as much as 90 percent. If they complete the challenges she imposes on them over a few weeks, she gives them up to $5,000 to go towards their debt.

I started with my budget as she suggests and found that, although I’m in debt, my income is greater than my expenses (unlike most of her participants). That’s the most enviable situation to be in. For sure, I could go to a barber instead of the delightful Gabriel for my haircuts, but that would only save me about $8 per paycheque and that cutback (pardon the pun) isn’t necessary at this point. In the end, my budget maps not only the net amount of each expense, but also the monthly and, more importantly, the per-paycheque net amount for each. Indeed, I always wondered why the two “extra” pay periods for someone like myself who’s paid every two weeks don’t seem to be “extra pay days” as one would expect when just looking at the surface.

I then considered, but stopped short on, imposing the “magic jars” system on myself. Instead, I took a two-pronged approach: the “calendar” approach for my cash flow in one sheet so that I can see when certain recurring amounts go out, and a combined “virtual savings accounts / daily expenses” approach in another sheet for daily expenses including those I automatically set aside (i.e., not spend right away), namely 6 fixed amounts ranging from $4.20 to $43.30 per paycheque for haircuts or any of those irregular or occasional musts.

As a result, in the cash flow sheet, I have only one line per pay period for stuff I lumped together like food and other expenses. During the current period, that amount goes up based on the entries I make on my daily expenses sheet. On payday, the surplus or deficit from the previous period is added to or subtracted from the net paycheque — often when there’s a surplus, I put it on my line of credit — and the 6 amounts above are immediately deducted from that “lumped together” total so that I will have the cash to pay for those things when they’re due. That leaves me with the remainder to play with, but although sometimes it seems like the cash flow is in the red, in reality the variable accumulated sum of those 6 “virtual accounts” remain part of the actual balance in my bank account.

What’s discombobulating about this approach is that the balance in my bank account doesn’t mean anything anymore. It seems like it should be heading into negative territory one of these months, but as long as I trust only what I see in my spreadsheet for any given day, that’s really where I stand. I don’t know how many times I re-examined my formulas to make sure I’m not double-counting (or not counting) some expenses, but the logic holds even though the bottom line in my bank account never seems to add up to anything I see on my spreadsheets.

So, I’m staying the course. I think the worse thing that can happen is that I’ll find that I’ve been too aggressive attacking my debt — it looks like I’m putting over 24% of my net towards debt repayment, which I gather is about 9% more than what Vaz-Oxlade suggests is optimum, although her 15% figure might be for when someone HAS to pay more than that in order not to sink further in debt — in which case I’ll just have to backpeddle a little bit on that front. Besides, even if it’s only a few dollars here and there, keeping one’s debt as low as possible means lower monthly interest charges on the line of credit on which I consolidate my credit-card expenses. Not only is the interest rate much lower on the line of credit, but the interest is paid monthly from my main account, meaning the outstanding balance on credit doesn’t balloon, not to mention that I never pay a penny in interest on credit cards due to the 21-day grace period.

Having Much of a Life Lately?
As you can tell, not really, but unlike a year or so ago, that’s not depressing me. Funny how only a few months in therapy changed my outlook so fundamentally.

Like I said, the budget thing has become very empowering for me. It’s actually set up to be the worse-case scenario, yet despite my expensive screw-up a month ago, it still looks like I’ll be relatively debt-free by the end of 2013. Given how time flies, that’s nothing and extremely encouraging! While I’m currently not following Vaz-Oxlade’s “pay yourself first” suggestion, that’s only because I have something up my sleeve that will turn this worse-case scenario on its head.

But I haven’t been going out much lately, either. I get that way in winter. However, if I must be candid, I haven’t felt like it because of the 20 or so pounds I gained in the last two years. A lot of my clothes doesn’t fit well, but rather than buy new clothes, I prefer to lose the weight. Granted, by that time, that clothes will be in need of replacing, too, but I rather buy “skinny clothes” than adapt and buy “fat clothes.” I may like bears but I don’t see myself as one. Besides, I prefer hunky bears over fatty bears.

Any Vacation Plans?
Yup! That’s in the budget and it’s also why I want to lose weight. My first vacation will be for a week around Easter when I’ll be flying to Moncton and spend that time with my mom. But the second vacation — the “for me” fun vacation — will be the first two full weeks of August when I plan to spend a few days in Provincetown and then drive up the coast to Moncton (again) and Halifax. It’s not my dream vacation to Mykonos just yet, but I hope that’ll come in 2013 or 2014, especially if I can find someone to travel with. It seems like it would be more fun to travel to Greece with a friend than on my own.

Do You Still Follow Politics?
Avidly! But whether it’s in Québec or Canada or the U.S., there just seems to be so much I could be railing against that I don’t know where to start. However, combined with the uncertain economy, politics has become rather depressing. There comes a point where it’s better to go inside a little bubble to preserve one’s sanity.

Time Matters

I had a total lightbulb moment last Friday night and finally arrived at a clever programming feat. And by the time I finished posting this entry, I refined it even more, trimming 5 lines of coding from an already sparse function.

Calendar Snapshot

The above snapshot is that of an application I developed for work, but always with the intention of eventually distributing it. It looks very simple: it’s an online group scheduler. It easily allows a group of people, regardless of their time zone, to see what other members of the group are doing. If I, as a group member, cannot schedule myself for a particular appointment, I can schedule a co-member instead. Pretty straight-forward so far, right?

What you don’t see in this screenshot is that I can change the day view to another time zone. So, say I’m trying to schedule an appointment with someone who is in British Columbia, and the appointment should be at 10:00 am BC time. All I need to do is first switch the time zone pull-down (which you don’t see here) to BC, then click on the plus sign in my column corresponding to 10:00 am BC time to schedule the appointment. Then, when I’m done and I switch back to my time zone in Québec, the appointment will show as being at 1:00 pm, as BC is 3 hours earlier than Québec.

The underlying concept is as follows: Each day is divided into 96 slices, each representing 15 minutes. For me in Québec, Slice 41 represents 1:00 pm but corresponds to 10:00 am in BC. The Eastern time zone is designated as Zone 3 while the Pacific time zone is Zone 6. Most time zones in the northern hemisphere observe Daylight Saving Time at the same time — in North America, Mexico, as usual, is the odd man out in that it starts DST later and ends it sooner, as happens in Europe — so even when the time changes, the 3-hour difference between Zone 3 and Zone 6 stands.

However, there are places like Saskatchewan, where DST is never observed, or the far eastern reaches of Québec’s north shore, which is in the Atlantic time zone (Zone 2 in my scheme) but, since it doesn’t observe DST, is the same time as the rest of Québec when DST is being observed — in other words, Zone 3 in my scheme. In the case of Saskatchewan, the pull-down changes automatically so that this province is listed with Manitoba in winter (Zone 4) but Alberta in summer (Zone 5). As this post from April 2003 attests, I’ve been struggling with the notion of time zones, time differences, and observance and non-observance of DST from many, many years. (In fact, what I wrote 8 years ago about Indiana is no longer true.)

While most of my application relies on PHP’s inherent time zone controls (e.g., for Montréal, putenv(“TZ=America/Montreal”)), each user’s profile also includes the zone number per my group scheduling scheme. And it seemed totally unacceptable — not sufficiently user-centric — to require, as does WordPress (the blogging software I use for aMMusing), those who live and work in one of the unusual time zones to manually switch when we go to and from DST.

To add to the complexity: Most countries in the southern hemisphere do not observe DST, but when they do, they do so in our winter months because it’s summer in their hemisphere. If only it were as simple as, “On the day when we go to DST, they get off DST,” then the programming challenge, while considerable, would be relatively simple. But it’s not that simple.

Take Brazil as an example. Despite its width, most of that country is in one time zone and it observes DST. Right now (February 6, 2011), the time difference between Montréal and Rio is 3 hours, as in, Rio is 3 hours ahead of Montréal. However, towards the end of February, Brazil will cease observing DST and we still won’t be observing it here, so the difference between Montréal and Rio will be 2 hours until mid-March when we will start observing DST, at which point the difference between Montréal and Rio will drop to only 1 hour. On October 16, while we will still be observing DST, Brazil will start observing it as well, so difference will rebecome 2 hours. And finally, when we stop observing DST on November 6, the Montréal/Rio difference will rebecome 3 hours.

Okay, if you followed me this far and think you have it all figured out, I’ll throw Uruguay at you to burst your little bubble. Uruguay is essentially the same time zone as most of Brazil, complete with observance of DST; however, that country’s transition dates are different than Brazil. Instead of ending DST in late February, Uruguay only ends it on March 13, which coincidentally is when we start observing it. And instead of starting it again like Brazil on October 16, Uruguay restarts it October 2 …like the parts of Australia that do observe DST — Australia, which of course, is more than half a day ahead of Uruguay.

So, my challenge was that comparing time differences against Coordinated Universal Time (UTC) was as helpful as tits on a bull. In places where DST is observed, the difference for them is always their basic offset from UTC, that is, X hours or X+1 hours. In other words, in Montréal, we’re either 5 hours behind UTC in winter (i.e., X=–5) or 4 hours behind UTC in summer (i.e., X+1=–4). But for that far northeastern reach of Québec I mentioned earlier, which never observes DST, X=–4 year round, just as for Saskatchewan, X=–6 throughout the year.

The thought of writing hundreds of lines of code upon looking up every exception and hope like hell none ever change brought me close to abandoning any hope of achieving a user-centric script. In fact, I found my first attempt at this fool’s errand didn’t work all the time; Saskatchewan always ended up as a Zone 5 instead of 4 in winter and 5 in summer. That was until it occurred to me that my mistake was to rely on UTC. Instead, I should arbitrarily pick what I consider a “normal” time zone — one in the northern hemisphere that observes DST — compare its offset on any given day against the “target” time zone (i.e., the one whose Zone number I’m trying to find), and adjust that Zone number accordingly.

The result: A 25-line function that I can call from anywhere in my suite of applications (including the group scheduler) and that works 100 per cent of the time! And to illustrate, I’m going to take Alberta (AB), Saskatchewan (SK), and Puerto Rico (PR) as examples of Zone whose number I’m trying to find.

— Regardless of its current offset to UTC, we know that Montréal (Mtl) is always Zone 3 in my calendar scheme.

Time Zone
Date Mtl
Feb 06/11 3
Mar 13/11 3

— Using this function like this, which returns the number of minutes offset between two time zones, start by calculating if Zone 3, synonymous with Montréal, is currently 4 or 5 hours behind UTC.

function get_timezone_offset($the_benchtime, $your_tz, $their_tz = null) {
if(
$their_tz === null) {
if(
!is_string($their_tz = date_default_timezone_get())) {
return
false;
}
}
if (
$the_benchtime == “”) {
$the_benchtime = “now”;
}
$origin_dtz = new DateTimeZone($their_tz);
$your_dtz = new DateTimeZone($your_tz);
$origin_dt = new DateTime($the_benchtime“, $origin_dtz);
$remote_dt = new DateTime($the_benchtime“, $your_dtz);
$offset = $origin_dtz->getOffset($origin_dt)$your_dtz->getOffset($remote_dt);
return
$offset;
}

Having determined that:

$whatdateandtime = “2011-02-06 00:00:00”;
$zone1 = “America/Montreal”;
$zone2 = “UTC”;

…calling the function is as simple as:

$TimeDifference = get_timezone_offset($whatdateandtime, $zone1, $zone2);

And since it gives the value in seconds, where 1 hour has 3600 seconds, convert to hours as follows:

$TimeDifference = $TimeDifference/3600;

So the result is:

Offset from UTC
Date Mtl
Feb 06/11 –5
Mar 13/11 –4

— Then, using the same function, calculate the number of hours the “target” zone (Alberta or Saskatchewan or Puerto Rico) is off compared to UTC.

Offset from UTC
Date Mtl AB SK PR
Feb 06/11 –5 –7 –6 –4
Mar 13/11 –4 –6 –6 –4

— Finally, calculate the target Zone number following this formula:

Base Zone Number — (Target OffsetBase Offset) = Target Zone Number

That formula is part of my “magic” function which refers to (i.e., uses) the function above to get the variable offset numbers.

And remember: Two negatives give one positive, so –7 — –5 is like saying –7 + 5, which is –2, and then 3 — –2 is like saying 3 + 2, which is 5.

Time Zone
Date Mtl AB SK PR
Feb 06/11 3 3 — (–7–5)
3 — –2 = Zone 5
3 — (–6–5)
3 — –1 = Zone 4
3 — (–4–5)
3 — 1 = Zone 2
Mar 13/11 3 3 — (–6–4)
3 — –2 = Zone 5
3 — (–6–4)
3 — –2 = Zone 5
3 — (–4–4)
3 — 0 = Zone 3

Invariably, the result is correct, per my time zone numbering scheme:

Time Zone
Date Mtl AB SK PR
Feb 06/11 3 5 4 2
Mar 13/11 3 5 5 3

Saskatchewan is indeed like Alberta in summer but like Manitoba in winter, and Puerto Rico is indeed like Montréal in summer but like Halifax in winter.

When I’m ready to distribute my script, the purchaser will have to choose one scheduling scheme from the following:

  1. The Americas
  2. Windy City to Kremlin (Americas East to Europe & Africa)
  3. Euroasia & Africa
  4. Asia & Oceania

Essentially, the east/west span is restricted to 10–11 hours. But the same function will always work, even if a scheme spans across the Greenwich line, with the only difference being the base city and its stable Zone number within that scheme:

  1. Montréal
  2. London
  3. London or Paris
  4. Some city in Russia whose DST resembles Europe’s

Or they could be based on Montréal, with only the stable Zone number changing to an improbable yet relational value within the scheme.

A spinoff of coming up with this function is that it brought to my attention that Newfoundland is not the only half-hour time zone in the Americas. Venezuela is the other, but it’s west of Newfoundland and, unlike Newfoundland, never observes DST. So, I was able to adjust the reference table for the Americas in my database and can now assert my application will always work. The cherry on the sundae would be to have a Spanish and Portuguese language file so that it could work in those languages in addition to the current English and French.

Blasts from the Old Job

FTPIn the nearly 4½ years since I began my day job, which I suppose I can’t call “new” anymore, I have hardly worked on what was the centre of my existence for several years before: my home-grown TextStyleM content management system. In fact, over the years I have even let go most of my clients, only creating a new TextStyleM submodule for one client last year and amending some of the MySQL queries in the CMS as a result of a major upgrade of the LAMP (Linux / Apache / MySQL / PHP-Perl) kernels on the server where my remaining clients’ sites reside. However, I have been keeping relatively current in web development with PHP/MySQL, as I have developed a series of applications for my day job — the initiative that earned me that big recognition/cruise last winter. I say “relatively current” because I haven’t changed the software I use — a text editor and FTP client — in about a decade because, really, a text editor is just a text editor and anything that we see online can ultimately be coded by hand.

About two weeks ago, one of my remaining clients came to me for help about uploading material in a new subdirectory within its domain. The client wanted access to upload the material on its own, which means giving FTP access. Normally it would be easier to have the client send me the stuff to upload, but I didn’t “fight” (because I didn’t feel like it) the assurance that “my neighbour and web developer is very familiar with FTP,” even though that statement sent chills down my spine and reminded me of how, a decade ago, I would have people say to me, “My 13-year-old nephew knows all about websites and even created his own webpage, so I’m sure he can help us update once ours is up.” (That’s what got me working on TextStyleM in the first place.) The only warning I gave is that if this guy screws things up, I won’t be able to fix anything until I return to Montréal late this week.

And sure enough, the phone started ringing around 8:30 this morning. But I’m on effin’ vacation and only got up and called the client shortly before noon. As I expected, everything that was “wrong” was totally out of my control, from changing on the template what’s between the bloody <TITLE> tags to correctly sending the files via FTP. Plus, wouldn’t you know it: the site in the subdirectory looks almost fine in Internet Explorer but like total shit in Firefox. I know this is a snooty comment on my part, but I can’t help wonder if this neighbour/web developer is merely using a Mac-equivalent of FrontPage of old without having a clue what the fuck is happening in the background.

This reminds me of my biggest technical weaknesses: I freely admit that, design-wise, I suck. And I always lean towards pure server-side coding rather than fancier (and, I also admit, often more user-friendly) client-side scripting. But, to this day, I seldom fall into the trap of browser-specific compliance issues, or not being able to read a CSS stylesheet, or, for that matter, unwittingly uploading files in ASCII versus binary mode or vice versa.

Additionally, as I mentioned to BeeGoddessM earlier this week, I’m reminded of how sad I feel about having essentially abandoned TextStyleM. As I use a server installation of WordPress to write this blog, I see how it’s a formidable CMS for this kind of online publishing, but I also see how TextStyleM had content management features far beyond anything I’ve seen in other any other CMS. For instance, if an image was deleted, TextStyleM would scan the entire site and REMOVE every reference to that image to prevent gibberish code or a broken image on the affected page(s). Plus, publishing a site in two languages is easy as shit with TextStyleM. However, as BeeGoddessM pointed out five years ago, the interface of my CMS needed to change to become more like the other CMSs out there. I started working on that makeover and it would have kicked ass had I had the time and energy to bring it to fruition. But work and other life-altering events intervened, so it never happened.

Despite how stupid the day job has become recently, I definitely prefer the steady paycheque over the uncertainty of freelancing. But I still feel some sadness at seeing thousands upon thousands of hours of work not leading to anything significant today.

Natural But Secure

PadlockWith the on-going attention Facebook has been receiving in the media and among its users about the complexity (impenetrability?) of its privacy settings, one of my FB friends recently posted a link to an article about this very topic and posited that this complexity is one of the main contributors preventing someone like his mother from ever joining the social network.

That article was part of a much larger website by someone named Thomas Baekdal that is dedicated to “showcasing great products, great innovations and great experiences.” But one article that particularly piqued my interest, perhaps because of my day job and the fact I always fall for such geeky topics, was “The Usability of Passwords.”

Considering that just about everything we do today is computer-mediated, we find ourselves having to manage a slew of passwords to gain access to those things. Sometimes, we get to choose those passwords; sometimes, they’re imposed on us. And when we get to choose them, they often not only need to meet certain criteria but also need to be changed periodically. As a result, we often end up creating simplistic passwords that could easily be cracked.

The best possible password, we are often told, would be one that is not a real word and contains a mixture of upper- and lowercase letters, numbers, and special characters, like utY#8asfF7. But try to remember something that’s so unlike the way we think! Thus imagine my surprise (and delight) at Baekdal’s suggestion that a pass phrase like “fluffy is puffy” would be virtually uncrackable.

That one wouldn’t meet the minimal requirements at my job; however, this notion is definitely one I intend to keep in mind the next time I’m forced to change a password.