There's no universally accepted "right" answer to questions of ethics. See https://en.wikipedia.org/wiki/Normative_ethics#Normative_eth... for some approaches.

I'll provide a few perspectives.

Act consequentialist ("hardcore"): Is the world as a whole better or worse off after you take that action? Probably better off. By taking that action, there'll be less money in your companies pockets. That money may trickle down a bit to Average Joes, but probably will go mainly to rich people who don't need it. On the other hand, you'll have more free time, you'll be happier, and your child will get to spend more time with your son.

Rule consequentialist: Evaluating the costs and benefits of this particular action is error prone, so you're better off just following a good rule of thumb. In this case, I think a good rule of thumb is to oblige by your contract. Your contract as a full time salaried employee is to, basically, give us your time for 40 hours a week and work reasonably hard. If your contract was some sort of fixed price freelance gig, then things would be different, but by signing the contract you did, you gave them your word that you would work reasonably hard for 40 hours a week, and keeping your word is a good rule of thumb.

Rule consequentialist: Evaluating the costs and benefits of this particular action is error prone, so you're better off just following a good rule of thumb. In this case, I think a good rule of thumb is to be honest, and tell your boss.

Deontologist: You have a _duty_ to follow your contract. You should do it _because it's your duty_, not because you think it'll lead to good consequences.

Deontologist: You have a _duty_ to be honest.

Deontologist: You have a _duty_ to be the best possible father you can be, no matter what it takes.

Virtue ethicist: You should follow your contract, because doing so is sticking to your word, and sticking to your word is virtuous. You shouldn't be sticking to your word because you think following that rule-of-thumb will lead to good consequences, you should be doing it simply because it's virtuous.

Virtue ethicist: You should do what is best for your son, because being a good father is virtuous.

Personally, I believe in consequentialism, and I believe that you can use your judgement to decide whether or not to use act or rule consequentialism, based on whether you think you have a decent grasp of the trade offs. If you don't have a good grasp of the trade offs, you can expect a rule-of-thumb to do a better job than your attempted analysis, and should go with the rule-of-thumb. Otherwise, go with the results of your analysis.

In this situation, it seems to me that the trade offs are relatively clear, and that you could go ahead and keep it to yourself. But I wouldn't blame someone for taking the position that the trade offs aren't actually too clear, and it'd be better to fall back on a "be honest" rule-of-thumb.

Note: I expect that if you told them, they would take the program, and either a) use it and fire you, or b) maybe keep you around as a contracter or something to add to the program. You wrote the program during work hours, on a work computer, presumably. So legally, it is there intellectual property. Assuming you don't have some atypical clause in your contract.