I'm using the extarticle class and I want to have a \subtitle command to add subtitles for sections. Here's what I expected:

Here is my current solution, quite ugly to be frank:
\documentclass{extarticle}
\usepackage{titlesec}
\makeatletter
\newlength{\fsizept}
\setlength{\fsizept}{\f@size pt}
\makeatother
\newlength{\titleruleheight}
\setlength{\titleruleheight}{0.075\fsizept}
\titleformat{\section}{\Large\sffamily}
{\thesection}{1em}{}[{\titlerule[\titleruleheight]}]
\newlength{\subtitleposfix}
\setlength{\subtitleposfix}{-2\baselineskip} %This should be linked with font size.
\newcommand\subtitle[1]{
\vspace{\subtitleposfix}%
\begin{flushright}%
\emph{\emph{------}#1}%
\end{flushright}\par}
\begin{document}
\section{The title}
\subtitle{The subtitle}
\end{document}
I find it hard to correctly align the title and subtitle. The 2\baselineskip above is just an inaccurate approximation. The real value should depend on font size and configurations of the titlerule (as you can see, this titlerule depends on the font size given by \fsizept).
I should add that I did some searches for existing questions such as this one. But I didn't find a satisfied solution for my case.
Anyway, is there a better way to achieve this?

\vspace{-\baselineskip}but this changes as the font size changes, so the final result would be unstable. Is there another way to just resembles my original\titlerule? – Jinwen Aug 24 '19 at 05:03\storeoldfsize? I didn't see the original value of\baselineskipandfsizeptget changed. 2) What does the\dimexprdo? It seems fine removing them. – Jinwen Aug 24 '19 at 10:23\smallto use these values and the new ones. They do change ... See for example what will happen if you add\fontsize{5}{6}\selectfontinstead of my\smallcommand for the subtitle. 2)\dimexprleft there because I was making some additions etc of lengths... but realized that doesn't needed ... I would leave it there in case that an extra constant length would be used for the vertical spaces. – koleygr Aug 24 '19 at 10:50