Perfect. This is the best way to calculate the speed of the train. I used to do this for years from the age of 10. However after I started travelling by AC it became difficult if not impossible. Of course those days speeds were much lower max. 90 kmph. I would even predict the speeds by hearing the rattling sound of the moving train on wooden sleepers (now replaced by concrete sleepers) and crosscheck my guesstimate by the method you have explained. Percentage error was around 10%. Good timepass. Still do it when I travel by 2nd class or sleeper and occupy a window seat.