After an independence referendum yes vote, I estimate it would take up to 4 years to negotiate a full exit from the UK, all the while taking care that none of the arrangements made would exclude Scotland from joining the EU. Unless the SNP, Liberals, Greens, half of Labour and the odd Tory want to show total hypocrisy, this exit deal probably should undergo its own referendum. Assuming this also succeeds, then Scotland could apply to join the EU, but there will probably be a requirement for an independent Scotland to show a record of stability and responsibility. This may take a further 4 years. When details of the EU deal are known then a third referendum may be needed.
The EU members such as Slovakia, Slovenia and Hungary and the Baltic states took around 11 years from independence to join the EU, Bulgaria and Romania a little longer.