Depends on the situation, and is mostly independent on the running times.
My favorite teacher in high school had been a computer engineer for around a decade before transitioning into teaching physics a few years after his first kid was born. When we asked him why he did that -- don't people usually want to move to a better paid job when they have kids, not the reverse? -- he said his old job was more interesting but the hours, commute, crunch time leading up to project deadlines, etc., kept him from spending as much time with his family as he wanted. By the time he was my teacher, he had his school routine pretty optimized: he walked his kids to elementary school in the morning, showed up at our high school right next door just in time for first period, got all his marking and planning done during his 90 minute planning period and lunch, and was back picking up his kids 10 minutes after classes let out. He had summers off with them as well...
So a late career or savant software engineer or an early career teacher? At least chose numbers that are in line with reality.
The average salary for an entry-level software engineer in the United States is $63,304 per year. Glassdoor estimates the average salary to be $106,190 per year
Average Teacher Starting Salary. $48,784 · Average Teacher Salary. $83,400