Machine downtime is defined as the time when a machine doesn't perform due to breakdown or it is out of order. When machine is down you could not producing anything. That is why it is considered a lost time or loss of standard time.
If you are looking for a formula for calculating formula for calculating machine downtime, I don't know if such formula exists.
Pointing to your first explanation - the mechanic may reach to the machine later than the actual machine breakdown happened. So you will be counting less time as machine downtime than actual. So, this would not be the right way to measure machine downtime.
Pointing to your second explanation - Machine downtime is a lost time which is equal to loss of standard time. If the particular operator is producing SAH (standard hours earned) less or high than the standard time, that can be considered as the loss of opportunity to produce that much SAH. I have not seen any factory to measure downtime as SAH lost while a machine is down.
In my opinion machine downtime is one type of lost times like other lost times – like no feeding, power break-down etc.
Simple way to know and calculate sewing machine downtime is - ask sewing operator to note down the time when she/he found machine is not performing and need assistance from a mechanic. Second thing to note down - after reaching the mechanic at what time machine issue is rectified and fixed. The gap between these two times is machine downtime for this instance.
If machine breakdown occurred multiple times in a day, sum up all machine break-downtime to calculate total downtime in one workstation in day.
This way you can calculate machine downtime for a line and for the whole factory.
Also see: What is Non-Productive Time (NPT) and How to Track NPT?