I have an agreement with myself that if a timer on my phone is set for 15, 30, 60, 120, 180 minutes, I should work non-stop without any distractions (no food, no music, nothing except my work).
Since then, it's much more easier for me to work really hard and be very focused.
If I'm too lazy to set timer for 3 hours, then I set for 15 minutes. It's easy to convince yourself to work hard during 15 minutes. Then I usually become warmed up a bit and set a new timer for 30 minutes, then for 60 etc.
I also keep track of how much time I spend daily. For example, in October, I worked purely on algorithms like this:
01.10.2016 4
02.10.2016 6
03.10.2016 1.75 2
04.10.2016 2 0.75
05.10.2016 0.5
10.10.2016 0.5
11.10.2016 0.5
12.10.2016 1
13.10.2016 0.5 1
14.10.2016 1.5
15.10.2016 1 2.5
16.10.2016 0.25 2 2.5
17.10.2016 1.25
18.10.2016 0.5
Numbers are hours. I.e. 0.5 = 30 minutes. Several numbers mean that I had pause/time gap in between.
Algorithms/math and problem solving olympiad problems require a lot of really hard work. With a timer, I'm working much more effectively like I never did before.
P.S. Why timer on a phone instead of a computer? Well, it's easier for me to just click and close window on the computer. If timer rings on phone, I have to get up and walk to the phone (I intentionally put it on the next table).
By the way, it's very good to keep a journal because overtime your collected data about yourself become valuable. For example, I plan to draw a graph with moving average, so I would see overall picture how dedicated I'm. If you don't have such data, it's easy to fall into trap convincing yourself how good you are (like I did before).